user3569535
user3569535

Reputation: 11

someone know how to loop this in as3?

I want to replicate this operation in 16 elements with the same final number and the same root, is there any way to do?

this is my try

for (var i:Number=1; i<=16 , i++)
{
  this("masInfo"+i).x=this("btn"+i).x
  this("masInfo"+i).y=this("btn"+i).y

}

Upvotes: 1

Views: 29

Answers (2)

Andrew Sellenrick
Andrew Sellenrick

Reputation: 1016

I believe what you are trying to do is this.

for (var i:Number=1; i<=16 , i++)
{ 
  this["masInfo"+i].x = this["btn"+i].x
  this["masInfo"+i].y = this["btn"+i].y
}

Upvotes: 1

Discipol
Discipol

Reputation: 3157

Create a class with a static function that has two string parameters, in this case would be "masInfo" and "btn", or whatever you want to put in those parameters.

Upvotes: 0

Related Questions