//
//
// VERSION 1
//
//
var xspace = 20;
var yspace = 20;
var xmax = 400;
var row = 0;
var col = 0;
var len = 10;
for ( var i = 0; i < len; i ++ )
{
var depth = this.getNextHighestDepth();
var t = this.attachMovie ( "box", "box_" + i, depth );
var nx = ( t._width + xspace ) * col;
if ( nx > xmax )
{
col = 0;
++row;
nx = ( t._width + xspace ) * col;
}
var ny = ( t._height + yspace ) * row;
++col;
t._x = nx;
t._y = ny;
}
//
//
// VERSION 2
//
//
var xspace = 20;
var yspace = 20;
var width = xspace + 30;
var height = yspace + 30;
var rows = 5;
var len = 10;
for ( var i = 0; i < len; i ++ )
{
var depth = this.getNextHighestDepth();
var t = this.attachMovie ( "box", "box_" + i, depth );
var col = (i % rows);
var row = (Math.floor( i/rows ));
t._x = width * col;
t._y = height * row;
}
_____________________________
Jesse Graupmann
www.jessegraupmann.com
www.justgooddesign.com/blog/
_____________________________
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ben deroo
Sent: Monday, June 04, 2007 5:39 PM
To: Flashcoders mailing list
Subject: [Flashcoders] thumbnail panel
hi,
I'm trying to create a simple sample thumbnail panel with movieclips, which
i'll later modify, but there seems to be something wrong in the code
code:
//
for (var i:Number = 0; i<10; i++) {
var t = attachMovie("box", "box"+i, i+1);
var Xspacing:Number = 20;
var Xreset:Number = 0;
var Yspacing:Number = 20;
var counter:Number = 1;
t._x += (t._width+Xspacing)*i;
if (t._x>400) {
//counter++;
t._y = (t._height+Yspacing);
t._x = Xreset;
t._x += (t._width+Xspacing)*(counter);
} else {
//counter++;
}
}
//end code
I'm trying to create several rows, but seem to be failing to do so, is this
a conditional logic error?
thanks for any help
Ben
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com