PDA

View Full Version : duplicateMovieClip when clicking another MC


Sergio
04-09-2001, 10:48 AM
Hi,

I'm facing a problem with MC.
If I take the exemple of the tutorial about duplication of MC (http://www.actionscripts.org/tutorials/beginner/DuplicateMovieClip/index.shtml) it works fine.

So I've tried to use the same code that would act when clicking on a MC and it's not working??? (no new MC is instanciated

onClipEvent (mouseDown) {
duplicateMovieClip ("box", "box3", 1);
setProperty ("box3", _x, "200");
}

I guess the MC is sending the command to itself so I've try the following:

onClipEvent (mouseDown) {
duplicateMovieClip (_root.box, "box3", 1);
setProperty ("box3", _x, "200");
}

This is not better.

Please, help.

Marx
04-09-2001, 12:22 PM
Hi..
Try this:

onClipEvent (mouseDown) {
duplicateMovieClip (_root.box, "box3", 1);
setProperty ("_root.box3", _x, 200);
}

Or Flash 5 syntax:

onClipEvent (mouseDown) {
_root.box.duplicateMovieClip("box3",1);
_root.box3._x=300;
}

Hope this helps.

Sergio
04-09-2001, 01:03 PM
I'm using Flash 5 and your second code is working fine.

Do you know where can I find the different ways to use a method and what are the methods of each class?
(I didn't knew it was possible to call <i>duplicateMovieClip</i> on the MC without passing 3 parameters)

Thanks a lot for your help.

Marx
04-09-2001, 02:35 PM
Hi..
The only difference between the code I provided and your code was that I typed it using the evaluate action.
The new syntax more closely resembles the way you would type javaScript. The international standard of javascript is derived from a document provided by The European Computers Manufactures Association (ECMA-262).
As ActionScript is based on ECMA-262 it makes sense to follow their guidelines.
Theres nothing wrong with using the predetermind scripting that Flash provides, but once you get used to it you'll find it quicker to type manually.

Good luck.