Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

Instance name

$
0
0

Flash CC

I'm creating a number of buttons using the below:

 

setBut('butPass', 'Password', bX, bY, bS);

setBut('butUser', 'User Name',bX, bY+=80, bS);

// etc

 

function mcP(e:MouseEvent):void

{

      aTf.text = e.target.name+": " + ar[0] + ' ~ ' + ar[1] + ' ~ ' + ar[2];

}

 

function setBut(vMcn:String, vBt:String, vX:int, vY:int, vS:Number):void

{

          var vMc = new ButtOn;

          vMc.name = vMcn;

          vMc.addEventListener(MouseEvent.CLICK, mcP);

          vMc.txt.text = vBt;

          vMc.txtS.text = vBt;

          vMc.x = vX;

          vMc.y = vY;

          vMc.scaleX = vS;

          vMc.scaleY = vS;

          addChild(vMc);

}

 

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...


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>