This content has been marked as final. Show 6 replies
if you have your sprite as a movie clip with appropriate linkage setup you can use attachMovie() like so...
for(var i:Number = 0; i < 10; i++)
attachMovie("idHappySprite", "mcHappySprite" + i, this.getNextHighestDepth());
I hope this helps. ......if you want to get more information out of the kind folks on these forums you may want to be a bit more specific in your question. For instance, give us code snippets.
I apologize for the lack of details. This was meant to be a general question. I see your example, and I would like to make a similiar effect, but using Sprites in AS3. You see what I am looking into doing is creating a button (Simplebutton) and extending it to a list feature. Meaning, depending on how many buttons i want on the list. In order to accomplish this i would have to duplicate the same class and address there properties as needed. Again, this is using Action Script 3.0. Thanks for your reply, and if you or anyone else could help out...I would greatly appreciate it.
Look at the SimpleButton example in the AS3 Language Reference. Put that
code into a loop:
var maxButtons:Number = 10;
for(var i:Number = 0; i < maxButtons; i++)
var btn:SimpleButton= new SimpleButton();
/* see example */
/* move the button to wherever you need it */
Thanks, Raymond. Now I would like to change the position of each of those buttons. If you or anyone else can, check out my attached code. I tried using the random function, but it only moves on button.
Except for the very last button, none of them have any content, so you're
just not seeing them. Move your button state assignments into the loop.
Ah nice, thanks alot Raymond. Much appreciated. I attached the final code, just in case anyone else want to test.