first of all hi to all
i’m new to as3 and i need help with something i’ve been struggling for some time now
i would like to add multiple copies of one instance “mytocka_mc” to stage using ENTER_FRAME
here is the code that does all i need except leaving multiple copies of myTocka_mc on stage
I was googling and found it got something to do with arrays
i think i should create an array and on every ENTER_FRAME copy my original instance, push copied instance to array and at the end add whole array to the stage but i really dont know how to do that
thank you in advance
ps
sorry for bad english
kreni_btn.addEventListener(MouseEvent.CLICK, kreniClick);
stani_btn.addEventListener(MouseEvent.CLICK, staniClick);
var go:Boolean = true;
var counter:Number = 0;
var xBrzina:Number = 15;
var tockaGrafax:Number = 0;
myTocka_mc.x = 25;
go = false;
myTocka_mc.addEventListener(Event.ENTER_FRAME, vxplus);
function vxplus(ev:Event):void
{
if (go)
{
counter++;
tockaGrafax += xBrzina;
myTocka_mc.x = tockaGrafax;
if (counter > 30)
{
counter = 0;
go = false;
}
}
}
function kreniClick(event:MouseEvent):void
{
counter = 0;
go = true;
tockaGrafax = 25;
myTocka_mc.x = 25;
}
function staniClick(event:MouseEvent):void
{
tockaGrafax = 25;
myTocka_mc.x = 25;
counter = 0;
go = false;
}