Button with random time and random pictures
I Would create, with as3, a button with random pictures that change at random time.
Any advice?
Thanks.
I Would create, with as3, a button with random pictures that change at random time.
Any advice?
Thanks.
Thanks again Ned,
I sent an exemplification of the script.
Concerning the Timeout maybe I have solved.
I am currently staying at this point, I can not run a variable refers to the name of a bitmap (see below "this.addChild (image + i);".
//--------------------image 1
var imgA:BitmapData=new M1(3,3);
var image0:Bitmap=new Bitmap(imgA);
image0.x=30;
image0.y=50;
//--------------------image 2
var imgB:BitmapData=new M2(3,3);
var image1:Bitmap=new Bitmap(imgB);
//this.addChild(imageA);
image1.x=130;
image1.y=50;
button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
var i = Math.floor(Math.random()*2);
var imgC:BitmapData=new M1(3,3);
image0.x=270;
image0.y=50;
this.addChild(image+i); //this doesn't work ____________________________________
trace(i);
}
button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame2);
function fl_ClickToGoToAndStopAtFrame2(event:MouseEvent):void
{
{
var i = Math.floor(Math.random()*2);
var imgC:BitmapData=new M1(3,3);
image1.x=270;
image1.y=50;
this.addChild(image1);
}
}
Try using: this.addChild(this["image"+String(i)]);
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.