-
function for common movieclip script
Hi. I am using this script below for 5 mcs in a swf. I will end up with 5 similar swfs, so 25 times. Is there some clever way to write a function to reuse the code......??
this.broch1_mc.onRelease = function(){
empty_mc.attachMovie("brochmain1MC","brochmain1_mc ",1, {_x:-20, _y:-20});
}
-
Senior Member
not sure what you are exactly asking... do you mean, use that code like 5 times in a row... or just have it to be able to use without writing it all out again???
So many Ideas
So little Time
-
in each of my 5 swfs, I have 5 mcs that will load 5 different mcs when they are clicked....
I can write that code 5 times(with the different MC names etc), in each of my 5 swfs, or I was wondering whether there was a way to write the code more simply and not have to reapt it 25 times in the end...make sense??
-
Senior Member
i believe you can put it in a function...something like this...
Code:
onClipEvent (load) {
function attachclip(s,x,y) {
this.broch1_mc.onRelease = function() {
empty_mc.attachMovie("brochmain1MC", s, 1, {_x:x, _y:y});
};
}
}
then when you want to call the function there you would do this...
Code:
attachclip("name",-20,-20);
That should work fine... if it doesnt, it is probably because it is on a MC or cant get to where it is supposed to be where ever you plan to call that function... if that happens try asking someone else...but the function shouold work.... hope this helps,
Peace,
~Bill
So many Ideas
So little Time
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
|