PDA

View Full Version : Simple syntax question


____
04-09-2004, 01:21 PM
for(i=0; i<10; i++){
_root.duh.attachMovie("movie", "movie"+i, i);
_root.duh.movie[i]._x=_root.duh.movie[i-1]_x+=10

}

I guess I'm just not referencing i correctly in the third line of code...I know this is simple...

tg
04-09-2004, 02:51 PM
try:
_root.duh["movie"+i]._x=_root.duh["movie"+(i-1)]._x+10;

____
04-09-2004, 04:45 PM
Thanks, you're a savior...i knew i was just doing something stupid

tg
04-09-2004, 04:52 PM
not stupid at all.... what you had is alot closer then some of the posts seen around here.
cheers.

____
04-09-2004, 06:29 PM
Thank you, but alas I have another question.

Im loading in data from a database...So I'm printing out the rows...and im gonna loop through those

so heres me loading everything in
stop();
rand=Math.random(100);
viewing=new LoadVars();
viewing.load("viewnews.php?" + rand);
viewing.onLoad=function(){gotoAndPlay(2)}

now i have a variable declared in php for flash called entries
so i wrote this in the second frame....thing is i have the number of rows display in a text box on the root of the movie...but my loop wont work now..with the entries variable



_root.test=viewing.entries
stop();
for(i=0; i<viewing.entries; i++){
_root.duh.attachMovie("movie", "movie"+i, i);
//_root.duh.movie[i]._x=_root.duh.movie[i-1]_x+=10
_root.duh["movie"+i]._y=_root.duh["movie"+(i-1)]._y+10;



}



I hope this made sense
Thanks(again),
Eric

____
04-09-2004, 07:11 PM
Oh, nevermind...I got it to work..I'm a schmuck
thanks again