-
attaching scripts to duplicate movies
im wondering if theres a way to attach a this.onEnterFrame blah blah blah script onto duplicated movieclips..
dont really like to spread my scripts around to keep my stuff neat, but i cant get a way round duplicated movieclips..
-s7N
___________________________________
time you enjoy wasting, isnt wasted
-
Flash Gordon
try this:
PHP Code:
var dupl:MovieClip=org.duplicateMovieClip("new",1);
dupl.onEnterFrame=myFunction;
function myFunction () {
trace("bla");
}
-
hi, thanks for replying.
hmm.. i think the way you suggesting is the same way i tried in the first place.. but for just one movieclip its okay, but i am planning to duplicate like 100s of movieclips, thats why i am looking for a way to -attach- a this.onEnterFrame script to them.. =o i mean, i can't possibly give an instance name to everyone of them then every enter frame run a loop to all the instance names right?
-s7N
___________________________________
time you enjoy wasting, isnt wasted
-
Flash Gordon
Not really..
When you duplicate the movieclip, you attach the onEnterFrame action.
Why would you need that instance name again, as the function is
already applied?
Like for removing the onEnterFrame command?
For reusing hundrets of MovieClips i would suggest the following:
PHP Code:
var myMCs:Array = new Array();
for(var i:Number=0; i<100;i++){
var dupl:MovieClip=org.duplicateMovieClip("new"+i,i);
dupl.onEnterFrame=myFunction;
myMCs.push(dupl);
}
function myFunction () {
trace("bla");
}
// reuse:
var tmp:MovieClip;
for(var s:String in myMCs){
tmp=myMCs[s];
}
Is that more like you are looking for?
-
thanks. i guess thats the only way to do this.. thou i still got abit of problems with it, lemme play around with it
-s7N
___________________________________
time you enjoy wasting, isnt wasted
-
Flash Gordon
Just keep asking if you're stuck.
Maybe showing your source might help to understand
what you are trying to achieve.
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
|