Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Flash Programmers

  • Please log in to reply
No replies to this topic

#1 JacobS


  • Members
  • 21 posts
  • Local time:05:26 PM

Posted 26 June 2006 - 07:56 AM

Where are all the ActionScript programmers?
It's my personal favorite, and I'd love to see more!
Okay as to not make this thread useless I'll write a short tutorial on MovieClip duplication!

myClip.duplicateMovieClip takes four arguments.

First off the four is where i've written "myClip". This one's easy, it's simply the name of the movie clip you're duplicating...

Second is trickier... It is asking for the new name that the movieclip will be called by... we're going to introduce a variable here, and call it "'myClip'+_global.d"

Third, even trickier... depth... this is how deep the movie clip will reside. After all, we can't have two identical movie clips on the same layer, can we? tsk tsk... make it _global.d.

Fourth, we're going to ignore for now... for future reference, it allows you to modify atributes of the new movie clip... {_x = 20} would put the duplicated clip at _x of 20...

so now we have this:
myClip.duplicateMovieClip('myclip'+_global.d, _global.d);

Since "d" is undefined, we would not be able to duplicate... think about trying to move a movieclip to layer "undefined" lets init. d at 0 in frame 1.

Frame 1:
_global.d = 0;

Button 1(Just make a button you click to dupe... doesn't need to be a button, i've used mouse clicks and other fun events, too!)
	myClip.duplicateMovieClip('myclip'+_global.d, _global.d);
	_global.d++ //See here? we're making the variable increase by one every time a new movie clip is engendered!

Okay so that would make a movieclip, notable named myClip, duplicate whenever button1 was pressed!

Of course, since the movie clip is not moving, they would stack and look rather boring and like 1 movieclip

lets make it a little more fun!

	_x = Math.random()*800;
	_y = Math.random()*600;

Now, when the movie clip is duplicated, it will hop around on your screen! YAY!
Lasciate ogne speranza, voi ch'intrate.

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users