i know this is a pretty basic question, but I am having trouble finding an answer, so please bear with me: I have a script that is attached to several different movie clips, and is triggered when the user clicks on the clip. Instead of copying the same piece of code to every instance of the clip, how do I trigger a piece of code that resides somewhere else thank
On each of you movie clip you want to control name their instance names in order (myMovie1,myMovie2,myMovie3,etc. Then try using a function... in frame 1 on your timeline setup a functions layer and on the first frame add something like this... // creates a new functio function MyFunctionName(){ // creates a for loop for 10 movie clips, but you can change the 20 to the number of clips you will use this code on for(i=1;i<=10;i++) //will set all the movie clips 1-10's X position down 1 _root["myMovie"+i]._y=_root["myMovie"+i]._y+10 You will still need a way to trigger the function. So whatever button you are pressing to trigger this code you will need the following script // calls the function MyFunctionNam _root.MyFunctionName() I'm still kinda new at this actionscript thing too. So someone else might have a better suggestion. But this is how I've beeing doing similar things Hope this helps Brya
No problem! Just glad I could help. Good luck!
Don't see what you're looking for? Try a search.
|