-
duplicateMovieClip under onClipEvent
Hi everybody!
I need to have a clip duplicate itself under an onClipEvent(load) handler, like:
onClipEvent(load) {
//clips duplicate itself
}
I've tried all sort of ways, always get a message to abort the script.
I would appreciate any help.
-
I'm beginning to think this cannot be done.
-
i=0;
_root.onEnterFrame = function() {
i++
mc.duplicateMovieClip("mc"+i,i)
_root["mc"+i]._x+=50*i;
trace(i)
}
this will duplicate a movieClip with an instance name mc
-
Thanks, only I would like to know if it can be done as part of an <onClipEvent(load)> attached to the clip I want to duplicate. Get me?
-
how about
onClipEvent (load) {
duplicateMovieClip (this, 1)
}
or something like that.
remember, the depth value is important, as only one item can appear on one depth (to my knowledge)
"great scott!"
"I know, this is heavy!"
-
This is the only alternative I hadn't tried. But then, how should I address the new copy of <this>? In other words, what would be the instance name of the new copy?
I think you are getting close. Please continue, and thanks!
-
uplod your FLA file, i dont really get what you mean
"great scott!"
"I know, this is heavy!"
-
Nothing more than on kf1 of "myMC_mc":
onClipEvent(load) {
duplicateMovieClip( "myMC_mc","copy1",1);
copy1._x = someValue;
copy1._x = someValue;
}
I wished I could put it more clear.
I appreciate your patience.
-
have you set up the linkage? (right cliuck in the library view) linkage will give it a name to be used in actionscript, much like a variable
"great scott!"
"I know, this is heavy!"
-
clip is already on stage, instance name "myMC_mc".
-
is the clip on the same level as the script?
"great scott!"
"I know, this is heavy!"
-
sorry i misread your first post.unless you are using flash5 and older then there is no reason to use onClipEvent syntax. so ....
_root.onLoad= function() {
my_mc.duplicateMovieClip("copy",1);
copy._x = someValue;
}
-
frustrated and on the point of giving up I decided to try with attachMovie, like:
onClipEvent(load) {
for(i = 0; i < n; i++) {
_root.attachMovie("clip", "clip" + i, i) ;
_root["clip" + i]._x = 50 + 50 * i;
_root["clip" + i]._y = 50 + 40 * i;
}
And it works! The question remains, why it doesn't work with duplicateMovieClip.
My sincere appreciation for your time and patience.
-
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
|