I'm creating a number of buttons using the below:
setBut('butPass', 'Password', bX, bY, bS);
setBut('butUser', 'User Name',bX, bY+=80, bS);
aTf.text = e.target.name+": " + ar + ' ~ ' + ar + ' ~ ' + ar;
function setBut(vMcn:String, vBt:String, vX:int, vY:int, vS:Number):void
var vMc = new ButtOn;
vMc.name = vMcn;
vMc.txt.text = vBt;
vMc.txtS.text = vBt;
vMc.x = vX;
vMc.y = vY;
vMc.scaleX = vS;
vMc.scaleY = vS;
I try naming the new instance (vMc.name = vMcn;) but on using the different buttons I get the following returns:
instance4, instance8, instance12, instance16 etc.
What am I doing wrong? Thanks...
First, try using
The 'target' can end up being someting that lives inside the object with the lsutener, such as a shape or another object. But the 'currentTarget' will be the object that has the listener assigned to it.
I had tried doing things with the items inside, which were of course responding as you said.
Thank you very much.