-
Senior Member
Combine these into a for loop...
Hi. I have this code that I'm trying to optimize.
Code:
extendTween = new TweenExtended(img01_mc.img_mc,["_x"],easingType,[img01_mc.img_mc._x],[499],0.5,true);
extendTween = new TweenExtended(img02_mc.img_mc,["_x"],easingType,[img02_mc.img_mc._x],[499],0.5,true);
extendTween = new TweenExtended(img03_mc.img_mc,["_x"],easingType,[img03_mc.img_mc._x],[499],0.5,true);
I'm trying to put that all in a for loop like this:
Code:
for (i=0; i<10; i++){
path = _root["img0"+i+"_mc.img_mc"];
pathx = _root["img0"+i+"_mc.img_mc"]._x;
extendTween = new TweenExtended(path,["_x"],easingType,[pathx],[499],0.5,true);
}
But it doesn't work. Any ideas?
Thanks,
/Flip
-
Have you tried putting in the ( ) brackets? and combine _root with img0 bit
Your code :
path = _root["img0"+i+"_mc.img_mc"];
With brackets and combined path:
path =("_root.img0"+i)+"_mc.img_mc";
-
Re Member
try this:
path = _root["img0"+i+"_mc"].img_mc;
pathx = _root["img0"+i+"_mc"].img_mc._x;
*** Because .img_mc is not part of dynamic names, cannot included into dynamic naming bracket.
By doing this, data type for "path" is MovieClip, data type for "pathx" is Number
Last edited by websam; 06-07-2005 at 09:32 PM.
Challenging you: I explore my strengths;
Being challenged: I discover my weaknesses;
Defeating you: I GIVE you my knowledge;
Being defeated: I GAIN your knowledge;
-
Senior Member
Originally Posted by websam
try this:
path = _root["img0"+i+"_mc"].img_mc;
pathx = _root["img0"+i+"_mc"].img_mc._x;
*** Because .img_mc is not part of dynamic names, cannot included into dynamic naming bracket.
By doing this, data type for "path" is MovieClip, data type for "pathx" is Number
Thanks man, that worked like a charm
/Flip
-
[] dont work with dot syntax , but eval does
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|