-
Designer, Programmer, Musician
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
Hi,
I assume you have 5 clips on the stage named mc1, mc2, mc3, mc4, mc5
You can not change the name of a time line placed clip by the way.
so mc.name = "mc"+ adder; would have thrown errors to see to start with.
Maybe this will help you along
PHP Code:
import flash.display.*; import flash.events.*;
var Num:Number; var Amount:Number = 5;
var ClipArray:Array = [mc1,mc2,mc3,mc4,mc5];
for (var i:Number = 0; i < Amount; i++) { var Mc:MovieClip = ClipArray[i]; Mc.Num = i + 1; Mc.x = i * (ClipArray[i].width + 2); Mc.y = 200; Mc.buttonMode = true; Mc.addEventListener(MouseEvent.MOUSE_DOWN, Press); } function Press(event:MouseEvent):void { var mc:MovieClip = MovieClip(event.currentTarget); trace("Num = " + event.currentTarget.Num + ". Name = " + event.currentTarget.name); //addChild(mc); }
Last edited by fruitbeard; 11-09-2013 at 05:26 AM.
-
Designer, Programmer, Musician
Ok thanks.... i was about to say your code will not work , but then I realized I can make a for loop to push all the "mc" names into the array (mc1, mc2...mc40, mc50....etc) I already found (on saturday) the way of returning the movieclip pressed value, with the currentTarget, getChildAt and target methods. That was the detail i was missing. Thanks fruitbeard!!!!
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
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
|