China Naming Network - Eight-character lottery - To the experts: Ask flashcs5.5 as3 for many buttons. When you click any button, you will load the picture corresponding to the button, and you will delete the picture code.

To the experts: Ask flashcs5.5 as3 for many buttons. When you click any button, you will load the picture corresponding to the button, and you will delete the picture code.

The code is as follows: Some things need to be revised, please see my notes.

Import flash.display.movieclip;

Import flash.events.mouseevent;

Import flash.display.loader;

Import flash.net.urlrequest;

var _ ldr:Loader = new Loader();

var _ arr:Array = new Array(" jpg 1 . jpg "," jpg2.jpg "," jpg3.jpg "," jpg 4 . jpg "); //You need to change the name of the picture you need here.

this . addchild(_ ldr);

for(var I:Number = 0; I<4; I++){ // This 4 is to change the number of your buttons. If you have 6, change it to 6.

var ss:movie clip = this . getchildbyname(" Bt "+I)as movie clip; //Your buttons should be named regularly. For example, you can start with bt0. If there are five buttons, the last one is bt4.

ss.buttonMode = true

ss.addEventListener(MouseEvent。 ROLL_OVER,_ onRollOver);

ss.addEventListener(MouseEvent。 ROLL_OUT,_ on ROLL OUT);

}

function _ onRollOver(e:mouse event){

var n:Number = Number(e . current target . name . substr(2));

_ ldr . load(new URL request(_ arr[n]);

}

function _ on rollout(e:mouse event){

_ ldr . unload();

}