| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
simplicity
|
Flash - Add Object.
Well, I *thought* I knew a bit of actionscript . . . oh how I was wrong. Anyways, I'm looking for some actionscript that will allow be to toss in a movieclip over and over in a random position through a click of a button. Also is there a way to set which set of movie clips will be randomized for that particular button? I've scoured Flashkit/Actionscript.org, as well a few books to no avail. Anyone? |
|
|
|
|
|
#6 (permalink) |
|
simplicity
|
Ok, so I've got this running fine, but I'm running into problems duplicating multiple movie clicks with the same button. My code is: Code:
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Sep 2005
Posts: 4
|
Code:
this code has to go inside the first movie clip, and it'll duplicate each of those movie clips 10 times (for a total of 20). so if you wanted 20 of each you'd change "i < 20" to "i < 40" |
|
|
|
#8 (permalink) |
|
Registered User
Join Date: Apr 2003
Posts: 33
|
Couple of things though... 1) _root only breeds later scope problems - making it relative like this._parent is much more flexible. 2) You can cut your code down by doing poo=this._parent["boxx"+i] then just using poo, so to speak, and by making the code that creates the MCs into a function that you just pass a variable to (1 or 2), instead of very nearly duplicating that big block of code. 3) Also, duplicateMovieClip's a bit clumsy for this as you need one sitting there on the timeline. Ideally you could just replace it with attachMovie and give the clip an identifier in the library. |
|
|
|
#9 (permalink) |
|
Registered User
Join Date: Sep 2005
Posts: 4
|
thanks. Nobody else was really posting anything so I figured I'd just throw something out. AS isn't really my strong suit. Your suggestions could be easily incorporated though, hopefully the OP will post back if he decides to use it. |
|
![]() |