ActionScript 2.0 :: Turn Into A "for" Loop?

Jul 15, 2010

How could I turn this into a usable "for" loop? I don't know quite how they work. I feel like I could optimize a lot of my code using for loops.

Here's my example:

ActionScript Code:
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success)

[Code]...

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Turn Base Board Game - While Loop

Mar 15, 2009

I am trying to create a turn base board game. It has four player and out the the four players one is human and the rest are cpu's. The players are number 1,2..4. In the beginning of the game it ask's the user to which player will be the human player. A random number generator function picks a random number between 1-4 and that number player will go first.

There is a while loop that controls the game play something like:
var isNotEndofGame:Boolean = true;
var human:Number; //the user inputs this number.
var aPlayer:Number = getRandomNumber(1,4); //players: 1, 2, 3, 4
while(isNotEndofGame) {
if(aPlayer==human) doHumanMove();
else doCpuMove();

This reset's the player so they can keep on playing until game ends.
if(aPlayer==4) aPlayer = 1;
}
inside function doCpuMove() and doHumanMove() isNotEndofGame will become false when the game objective is met.

The problem I am having is when its the human players turn I want the loop to pause or wait so that the human player can do some interaction such as click a button or drag a movieClip. I tried adding adding mouseclick event listeners and timer neither worked.

View 1 Replies

ActionScript 2.0 :: Movie Clip Names For Each Loop - Turn The S[z] Into Something Like S1 - S2 Or S3 ?

Jul 6, 2003

okay here's my code

Code:
onClipEvent (enterFrame) {
for (z; z<4; z++) {[code]....

how do you turn the s[z] into something like s1 - s2 or s3 ? i just want different movie clip names for each loop..

View 2 Replies

Game Engine :: Flash Multiplayer Turn By Turn?

Oct 7, 2011

I'll start off by saying I'm a newbie, just putting that out there. How do you make a turn by turn multiplayer flash game? I don't know if an engine is made in AS3, PHP, Javascript, or whatever,I made my game already, it's just that it isn'tmultiplayer yet. Basically, there are lines, and each player crosses out a number of lines, and the last player to cross out a line is the loser. I want it where one user crosses out some lines, then presses End Turn, then the other does their turn and then presses End Turn to allow the other player to move his cursor. But how can I get both players to see the same frame and only have one player have the ability to move the cursor during a turn? Is there some easily adaptable multiplayer engine for flash for newbies out there

View 2 Replies

Way To Turn Sound Off

Mar 27, 2010

I have added a flash sound file to our homepage. How do I add an option for the visitor to turn the sound off? I don't have the .fla file for it.

View 1 Replies

Sound - Turn On/off Feature

Sep 10, 2009

I have a very simple project. I just need a flash video that has a sound file and a button to turn on/off.

View 1 Replies

ActionScript 3.0 :: Turn Off All Sound In The Swf?

Dec 27, 2009

I have some sounds in a timeline ( i purposely put them on time line rather then through AS3). But is there a way to turn off all sound in the swf, like is there a global sound channel?

View 1 Replies

CS4 - Turn Off Autodocking Panels?

Jan 13, 2010

Is there any way to turn off the autodocking panels. I just want my panels to be free floating and not stick together. The way they dock and stick together is the worst.

View 2 Replies

ActionScript 3.0 :: How To Turn Off Sound Only

Oct 23, 2011

How do you turn off the sound in a game only? I ask because I have two buttons in my settings: turn music on/off and sound on/off. turning music on and off is really easy because it uses a specific sound channel. But How do you turn off the volume the sound only (e.g. music is still playing but not the sound of the game)?

When I mute the sound via SoundMixer.soundtransform you can't hear anything so that's not what I wanted to have. In my game all sounds are thrown into an array. My first idea was that I go through all sounds listed in the array and turn off the volume but that's not working.

Code:
//not working
private var sounds:Array;
private var soundChannels:Array = [];

[code]....

View 1 Replies

ActionScript 3.0 :: How To Turn A DOB Into Months

Oct 5, 2009

How do you turn a date of bith into months. im doing this:
 
var dobDate: Date         = child.CHILD_DOB;  //10th Feb 2008var daysSince:uint        = Math.floor((nowDate.time - dobDate.time) / DateTime.DAY);                    var monthsSince:uint     = Math.floor( daysSince / AppConst.DAYS_IN_MONTH);
trace(daysSince) //603 - correct
trace(monthsSince) //20 - incorrect (it should be 19)
 
note:

AppConst.DAYS_IN_MONTH = 30
DateTime.DAY = 86400000

View 9 Replies

Professional :: Turn A FLA Into A URL Button?

Apr 26, 2010

I have a FLA file with 4 layers 2 of the layers are Text Boxes 2 of them are masks to make the different words "Shine" Is there a way to make the whole file a button so when people click on it, it goes to a different page?

View 6 Replies

Professional :: Turn 9 Separate Fla's Into 1?

Sep 20, 2010

I have 9 fla files. Is there anything I can do to create 1 swf out of 9 separate fla files??? I tried to cut and past the info all onto 1 timeline. Is there more than one way to do this?? I end up with multiple files with the same name in the library and it becomes a bit of a nightmare just trying to use the cut and past method.

View 4 Replies

Turn On Logging / Debugging?

Nov 25, 2011

I know virtually nothing about Flash so I'm kind of casting about in the dark.

I have the misfortune of being a BT customer, and whilst I have reasonable bandwidth (can view streaming high res video fine) I always have problems listening to radio programmes from the BBC. I think it could be buffering due to traffic shaping, or it could be the Flash applet used to play the content, or something else.

Is it possible to bring up some kind of debugging console, or view some kind of error log to see if there is some diagnostic information that could be useful in finding the problem?

View 1 Replies

ActionScript 3.0 :: Turn Xml Into Array?

Aug 6, 2010


How would I turn something like this...

ActionScript Code:
<feed name="BBC Top Story 1" url="bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml1">
<description>Top Story News</description>

[Code].....

View 3 Replies

ActionScript 2.0 :: MX, Make A Car Turn?

Apr 13, 2003

i saw the component thingy on kirupa... but i want to make a car drive in flash with just code.... there is a really good one on (click "drive!" on the menu and you can drive the little car around)... i would really like to know how to do this.

View 3 Replies

ActionScript 2.0 :: Turn Music On / Off?

May 26, 2003

I know how to turn music on/off but I now want to find out how to do the following. On 50cent.com, you can select from a variety of songs, then play the one you wish. I want to know how to do that, with the buttons changing the songs, then being able to press play, and stop. Could someone tell me how to do this, or redirect me to a tutorial that will teach me. I have flash mx, so you could post a flash mx tutorial if you wish. Another example is shown on West49.com, but I dont need to know how to open the playlist option they have. Just a simple left and right button changing the songs, thena a play and a stop button.

View 1 Replies

ActionScript 2.0 :: Turn All Buttons Off But One On?

Jul 2, 2007

I have 8 buttons. I need to turn one on, and turn the rest of them off. I can't figure out how to do this. do i use loops, booleans?

View 2 Replies

ActionScript 3.0 :: Turn Webcam Off After Use?

Oct 7, 2009

I'm using the webcam to record some footage, but when I'm done, I can't seem to turn the camera off (the LED stays on) no matter what I try.

Camera.getCamera("")
netStream.close()

View 3 Replies

ActionScript 3.0 :: Turn Value Into Something Usable?

Jan 13, 2010

How do I turn a value into something i can use without the "-" negative value if there is one.

I have an "imageLoaderHost" movieclip and I need it's x position to be usable wherever its at. for instance:

if imageLoaderHost is at -1258(x position), I need "b1" to go to 1258 (without the "-" as you can see).

View 2 Replies

ActionScript 2.0 :: CS4 - Button To Turn On AND Off?

Jun 3, 2010

I was just wondering if there's a way to write code for a button so it will, e.g., make a movie clip visible with one click, then hide it with a second click?what I usually do is give the mc two frames, so on click one it goes to frame 2 while it changes the visibility or alpha, and on frame 2 sends it back to frame 1 while changing the mc back. But I would like the flexibility of doing it on the fly with code rather than have to fiddle with each mc.I tried doing it yesterday with an if/else if statement, like, "if alpha is 0, change it to 100, else if alpha is 100, change it to 0" but couldn't get it to work. But if that's the way to go I'll keep playing with it.

View 4 Replies

ActionScript 3.0 :: Turn Off Pop-up With Fscommand?

Jun 21, 2010

with AS2, we use fscommand to do it, but AS 3 I don't know how to do ..

We can reference from: [URL]

View 1 Replies

IDE :: CS4 Turn Off Stage Smoothing?

Aug 3, 2010

I just upgraded to CS4. I'm working with sprites and using the properties of the images I've turned off smoothing to get that retro gaming feel. However, when viewing the sprites on the stage, everything is smoothed over which makes things difficult for me to animate. When I render everything, it looks perfect, just the way I want it with smoothing off, but how do I turn off the smoothing on the stage?

View 8 Replies

ActionScript 3.0 :: Create A Loop So Icons In Menu Continually Loop Indefinitely

Apr 16, 2010

I would like to create a loop so the icons in the menu continually loop indefinitly.[code]

View 2 Replies

ActionScript 3.0 :: Use A Loop To Create Text Field With The Loop's Current Value

Dec 11, 2010

I am attempting to use a loop to create text field with the loop's current value. The code looks like this:

ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}

So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".

View 7 Replies

ActionScript 2.0 :: Infinate Loop For M.clip.the Looping Part Does Not Want To Loop?

Jun 13, 2004

i'm trying to do an infinate loop for my m.clip.the looping part does not want to loop...it loops back to my firrst frame even though there are two same picture in the movie clip.....here's a sample of what i use for the infinate loop script..

[Code]...

View 2 Replies

ActionScript 2.0 :: Turn To Mouse While Moving?

Apr 24, 2009

Anyway, the "flier_mc" won't turn fully toward the mouse. I tried a few things, but it just keep turning away at some point.i can finally remove the pesky edge to edge teleport.

View 2 Replies

Flash8 Page Turn And Navigation?

Nov 27, 2009

I have created what looks like a book in flash.There is a corner turned over at the top right so when you click it the page turns. This is fine, however, what i want to beable to do is when I click it the page turns and goes to a new page. ( i have made all the other pages)I tried an on(release) but it just doesnt go to the page, it plays the movie clip but I cant get it to navigate aswell..

View 14 Replies

ActionScript 3.0 :: Turn Timecode Into Milliseconds?

May 18, 2010

How would you go about turning timecode into milliseconds. My timecode is in xml and comes in as a string. Timecode examples:

00:20
00:45
01:10

My end result is to call a nsStream.seek( milliseconds );

View 5 Replies

ActionScript 3.0 :: Controling The Turn Of Action?

Dec 30, 2008

controling the turn of action.

Example: i moved an object a certain distance. once it reaches a distance then it stops.i want to have a button; when you press will allow you to move the object again for the same distance.(what is code to do mthat).....then will need press button to allow it to move again.

View 8 Replies

ActionScript 3.0 :: Turn A Jpg Into A Sprite Dynamically?

May 25, 2009

Just want to turn a jpg into a Sprite dynamically.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved