Hi wvxvw.
The game is basically Frog Leap (google it if possible, can't post link yet) with a option to choose how many pairs of frogs you want to add in game.
So everytime i click in the button to start the game, i need refresh the screen with the number of frogs i choose.
ActionScript Code:
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Stage;
import flash.display.MovieClip;
var sapo_verde:Array; // frogs from right
var sapo_rosa:Array; //frogs from left
function cria_sapos(event:Event):void
{
var texto:String = valor.text;
var num = Number(texto); // get the number of frog's pair
sapo_verde = new Array ;
sapo_rosa = new Array ;
for (var i:Number=1; i<=num; i++)
{
var stg:Number = stage.stageWidth;
var rosa:ran=new ran();
var verde:sapo=new sapo();
rosa.x = (stg/2)-(100 * i);
verde.x = (stg/2)+(100*i);
verde.scaleX = -1;
rosa.y = 200;
verde.y = rosa.y;
addChild(rosa);
addChild(verde);
sapo_verde.push(verde);
sapo_rosa.push(rosa);
}
}
butao.addEventListener(MouseEvent.CLICK,cria_sapos);
I can't test the code right now, but would be something like that?
Can i remove the object "verde" in this function? Because i created this var in the first function.
*Edit:
Hi all. I did a new button and used the code and worked. Solved to me. Thanks wvxvw