List Info

Thread: Some code_ Grid squares




Some code_ Grid squares
country flaguser name
Canada
2007-09-05 13:34:45
Hey,
  I am having a gird issue that I can't seem to find or fix.
   I think it is  a modulus problem, but would love to hear
some positive responses.  If you can look at it and know the
solution I don't need a coded answer.  Just tell me what it
looks like.

Thanks

Paul.

the grid looks like this:

    *  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *
*  *  *  *  *  *  *  *  *

So it is broke at some point. I am still working on it, but
finally decided to ask for someone else to straighten out
the prob.  Sorry I know it is a pain in the ass to read code
but I canm't reduce it further really, but I will try.

Here is the code:

//function attaches movie clip 126 versions of clip instance
named grid1-grid126

function loadSquares() {   
 for (i=1; i<127; i++) {
  attachMovie("grid", "grid"+i, 10+i);
  gridTemp = eval("grid"+i);
  placeSquares(gridTemp, i);    // passes to copy of the
instance , and the current number of i
 }
}



//  function places grid instances.  modulus checks for
column complete  - total columns 14 rows 9.

function placeSquares(square, num) {   
 if (num%14 == 0) {
  xPlus += 86;    // width between coloumn placements.
  yNum += 14;   // multiplier for  Y placement. initial
value set to (nil) 0
 }
 yPlus = ((num-yNum)*(36));  
 square._x = 42+xPlus;            //  initial value away
from edge + column width increment. (every 14 objects
 square._y = 31+yPlus;            //  initial value away
from edge + row height increment.


 square._alpha = 100;
}
_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

RE: Some code_ Grid squares
country flaguser name
United States
2007-09-05 15:03:17
Hi Paul, 

Well, I couldn't fix it, but this is what it would look
like: 
 
var initX:Number = 10; 
var initY:Number = 10; 
var rows:Number = 14; 
var xSpacer:Number = 30; 
var ySpacer:Number = 20; 
var num:Number = 126; 
var parent:MovieClip = this; 
function loadSquares() { 
	var xPos:Number = initX; 
	var yPos:Number = initY; 
	for (var i = 0; i < num; i++) { 
		var mc:MovieClip = parent.attachMovie("grid",
"grid" + i, 10
+ i); 
		mc._x = xPos; 
		mc._y = yPos; 
		yPos += mc._height + ySpacer; 
		if((i+1) % rows == 0){ 
			xPos += mc._width + xSpacer + initX; 
			yPos = initY; 
		} 
	} 
} 
loadSquares(); 

If you need to use AS1 then just remove the strict typing. 
Experiment with the number variables until you get the
layout you want. 
 
Regards, 
 
-Keith 
http://keithrei
nfeld.home.comcast.net
 


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )