Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a quick easy for loop question. Please help me out

Status
Not open for further replies.

whoknows361

Technical User
Sep 22, 2005
228
US
I am having some trouble with my for loop.. for example:

lets say i'm doing a simple for loop as follows
Code:
for(var i = 0; i < myItemList.length; i++){ 

_level0.dimmer.contents.whitebox.attachMovie("producttb", "producttb" + i, 4000);

how would I target that newly created movie clip - say if I wanted to move the x value.
In my movie, this "producttb" mc is full of dynamic tb's and I want to be able to fill those tb's with the appropriate data. However, with the changing I values, I don't know how to target each one. Please help.

Jonathan

ie. _level0.dimmer.contents.whitebox.producttb ?? ._x = 100;
 
If you want to set a property (set _x to 100) within the loop, you can do:
Code:
for (var i = 0; i<myItemList.length; i++) {
	var mc:MovieClip = _level0.dimmer.contents.whitebox.attachMovie("producttb", "producttb"+i, 4000);
	mc._x = 100;
}
Or even simpler:
Code:
for (var i = 0; i<myItemList.length; i++) {
	_level0.dimmer.contents.whitebox.attachMovie("producttb", "producttb"+i, 4000)._x = 100;
}

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top