Trying to combine a fixed object name with a variable to address multiple objects on stage.
first: new as3. learned as1 years ago , had developed live, interactive jeopardy game use @ corporate meetings. flash cc not recognize as1 in process of trying learn can re-create game in as3.
that having been said, know problem must simple, yet cannot work. have row of identical logos (movie clips) glow , recede, , animate simulatneously. want use for/next loop address each logo (18 total) start @ sequentially higher frame create "chase" effect
each movie clip named: bulbanimtop_ followed 1 through 18. (eg: bulbanimtop_16, bulbanimtop_17, etc.)
i have verified trace command concatenations successful, problem can't seem come wth correct syntax address clips in gotoandplay() function.
here's code have:
var i:int;
for (i = 1; < 19; i++)
{
trace (i);
var bulb:string = "bulbanimtop_" + i;
trace (bulb);
bulb.gotoandplay(i);
}
thanks in advance can render!
the "for" loop complete within 1 frame objects start @ same time approach.
there many classes can (timer, setinterval function, settimeout function). i'll use find easiest , straight forward.
you'll need persistent var keep track of logo you're starting (named logonumber below). you'll need function play() logos movieclip after small delay. function run until hits number decide, using settimeout:
import flash.utils.settimeout;
// set number of first logo (logo_1, logo_2 ... logo_18)
var logonumber:int = 1;
// start 'er up
startlogo();
function startlogo():void
{
// stop if higher 18
if (logonumber > 18) return;
// start next logo, increment logonumber after
movieclip(this['logo_' + logonumber++]).play();
// call function again delayed 333ms (1/3 second)
settimeout(startlogo, 333);
}
More discussions in ActionScript 3
adobe
Comments
Post a Comment