Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-17-2012, 12:39 PM   #11
belonzion
Registered User
 
Join Date: May 2012
Posts: 2
Default

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

Last edited by belonzion; 05-17-2012 at 11:19 PM. Reason: Solved my question
belonzion is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:42 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.