ActionScript 1/2 :: Create An "if" Statement That Waits For The Right Arrow Key To Be Pressed?

Jun 18, 2010

For a game I am making I want to create an "if" statement that waits for the right arrow key to be pressed and for the global variable "movement" to equal 0. I used the code below:

if (Key.isDown(Key.RIGHT) && (_global.movement = 0)) {

When both those statements are true, I wanted the object to move to the left at the variable "speed". the entire code I used is below:

if (Key.isDown(Key.RIGHT) && (_global.movement = 0)) {
_x -= speed;
}

When the game is played I know that the "movement" equals 0 through the debugger tool, and when I press the right arrow key, the object does not move.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Wont Detect UP ARROW KEY Being Pressed

Dec 11, 2009

[code]This code will trace "up is pressed." into the output panel whenever the UP ARROW KEY is pressed.Try pressing up a couples times to make sure it works.Now hold down the SPACE BAR and the LEFT ARROW KEY at the same time.Try pressing up while you hold BOTH those keys down, and it wont detect the UP ARROW KEY being pressed.It also wont detect the UP ARROW KEY being pressed if you hold down the combination CTRL+LEFT ARROW KEY.

View 3 Replies

ActionScript 3.0 :: Arrow Keys And Space Pressed Simultaneously

Sep 5, 2009

ive tested my game on several different computers. it works well on my desktop, but 2 laptops suffer an issue when left, space and up are all simultaneously pressed... thus the character is unable to move, jump and shoot at the same time

View 2 Replies

ActionScript 2.0 :: If Statement - Change A Variable When A Button Is Pressed

Jan 29, 2009

I want to change a variable when a button is pressed. lingo: if this button is pressed then check varexample what number it has if it has a number then gotoAndPlay("example") and add 1 to varexample else, do nothing I'm sure if I get this kind of example down, I'll be able to figure the rest out by myself. =S

View 5 Replies

ActionScript 3.0 :: Use A For Statement To Create An If Statement

Jul 12, 2010

what I'm trying to do is create an else if argument for each object in an array based on a user set number

Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}

to which I want it to GENERATE THE FOLLOWING CODE:

Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}

the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?

View 4 Replies

ActionScript 3.0 :: "If" Statement Into The OnClipOver Function - Trace What Specific Button Is Being Pressed

Apr 8, 2011

I'm making the transition from AS2 to AS3 and have some rollover and rollout code below. I'm looking to place an if statement into the onClipOver function that can trace what specific button is being pressed. In AS2 I would use the "this" command to see which movieclip was being used. how to properly write the IF statements using AS3 in the code below.

[Code]...

View 2 Replies

ActionScript 2.0 :: Have A Preloader For A External FLV While The User Waits For The Buffer To Load?

Apr 14, 2004

Is it possible to have a preloader for a external FLV while the user waits for the buffer to load?The code I used is here: (I did not use the component panel but a video instance from the library)

// Create a NetConnection object:
var netConn:NetConnection = new NetConnection();
//Create a local streaming connection
netConn.connect(null);

[code]....

View 4 Replies

ActionScript 2.0 :: Preloading 5 Swf's + A Twist - Load The 1st Scene While The User Waits

Aug 9, 2005

I am creating an online demo which has 5 scenes that play one after another. My goal is to load the 1st scene while the user waits. Once the 1st scene starts to play, the 2nd scene begins downloading quietly in the background. That way, once the 1st scene is complete, it will automiatically play the second scene, the viewer none the wiser. I don't have any user interaction here.

View 3 Replies

ActionScript 2.0 :: Make A Timer That Waits 15 Seconds, And Then Makes A Movieclip Goto A Certain Frame

Nov 3, 2008

Im trying to make a timer, that waits 15 seconds, and then makes a movieclip goto a certain frame. Is this possible with Timer() and an if statement?

View 1 Replies

ActionScript 2.0 :: Create A Continuous Movement When The Mouse Is Pressed?

Oct 1, 2004

I'm working for a client that wants me to create an interactive map, which I can zoom in/out, move the map around, have a minimap guide, and other goodies. I've got the bulk of it created, but I got stuck trying to create a gamepad type controller which the user can click on, and it will move the map.

What I'm trying to do is this: The gamepad graphic I created is like a typical Playstation/X-box style thumbpad controller. There are an up, down, left, and right arrows graphic which the user can click to make the map go up, down, etc. (I have created code to let the users use the keyboards, in case they don't want to use the graphics)

Is it possible to create a continous movement when the mouse is pressed, or will my poor user be stuck clicking the mouse ad-nauseum?

View 4 Replies

ActionScript 2.0 :: Create A Stopwatch That Starts At 00:00 When A Play Button Is Pressed?

Aug 6, 2009

I'd like to create a stopwatch that starts at 00:00 when a play button is pressed, and then stops whenever the stop button is pressed. After the stop button is pressed, I would like the time to be displayed on the next frame, and say something like "You pressed the stop button in x". I'm using flash CS3...so actionscript 2.

View 4 Replies

ActionScript 2.0 :: Create Diagonal Motion When Two Button Is Pressed Simultaneously?

Nov 30, 2002

I was reading the "XY motion tutorial" and I am interested to know how to I create diagonal motion when two button is pressed simultaneously? Another question concerning the "Random motion tutorial" is what logical step did you take to come up with the "norm" variable? I notice that the motion becomes jumpy when "norm" was taken out.

View 1 Replies

ActionScript 3.0 :: Create An If Statement For Even.label?

Dec 10, 2011

I can create an if statement for # of selected items. However, how can I create an if statement for even.label? I have various labels and would like to create if statements based on if the text in my "labels" match up.

ActionScript Code:
function handle_checkbox_change(event:KcheckboxEvent):void {
trace("value before change : " + event.from);
trace("new value : " + event.to);

[Code].....

View 2 Replies

ActionScript 3.0 :: How To Create Conditional Statement

Dec 12, 2011

create conditional statement that will tell, that if time is 0 and enterframe event didn't played, we will trace in output window ("event didnt started")

View 1 Replies

ActionScript 2.0 :: Create A Button That When Pressed Will Make An Movie Clip Visible?

Feb 22, 2003

I am trying to create a button that when pressed will make an movie clip visible and set it to a specific position on the screen. When this same button is pressed a second time the movie clip will become invisible.

View 2 Replies

ActionScript 3.0 :: Create An If Statement That Executes Two Different Loops?

Oct 5, 2011

Is there a way to create an if statement that executes two different loops?

For example, If I was trying to make game with a button that when clicked creates random objects falling down and when the objects are destroyed, creates random objects floating up. I haven't seen anything online, but I'm wondering if anyone know. Is it possible or should I just create two different listeners?

View 3 Replies

ActionScript 3.0 :: Create A Code Such That Everytime A Button Is Pressed A Random Number Is Generated Between 0-14?

Feb 28, 2011

I am trying to create a code such that everytime a button is pressed a random number is generated between 0-14. With each of the 15 numbers (0-14) only being hit 10 times. I know how to create buttons and all that, its the random number thing thats stopping me.I created it using arrays in another programing language and tried to translate it to flash but I was unsuccessful. this is generally what i got

ActionScript Code:
var events:Array = new Array();
var order:Array = new Array();
var used:Array = new Array();

[code]...

View 9 Replies

ActionScript 2.0 :: If Statement - Goto A Random Frame Which Will Play A Movie When The Button "one" Or The Button "two" Is Pressed

Jul 20, 2006

its a gambling game of chance and I want it to go to a random frame which will play a movie when the button "one" or the button "two" is pressed. so on each button, I have the code:

[Code]....

View 7 Replies

ActionScript 3.0 :: Create IF Statement That When The LoadSWF Reach To Last SWF File?

Feb 23, 2011

I have an arrays of swf files that are going to be loaded.I want to create IF statement that when the loadSWF reach to last SWF file (question7.swf) it tweens the alpha of hidden btn.

something like this.

ActionScript Code:
if (e.target.content == qArray[6]+".swf" )
{
TweenLite.to(end_btn,0.5, {alpha:1});
}

This is to give a general idea of the full code

ActionScript Code:
var questionbox:MovieClip = new MovieClip();
questionbox.x=0;
questionbox.y=10;

[code]....

View 0 Replies

ActionScript 2.0 :: Create An If Statement That Would Load A Movie Clip?

Apr 19, 2004

is there a way to create an if statement that would load a movie clip after a different movieclip is loaded.

i have text_mc and scroll_mc. I dont want scroll_mc to load unless the content is loaded into the text_mc.

I tryed to make an if statement sort of like a something used for a preloader but I must have been off just a bit because it was not working. I dont even know if it possible.

View 7 Replies

ActionScript 2.0 :: Make A Box That Fades In When Pressed On The Button And Fade Out When Pressed For The Second Time?

Nov 16, 2004

I have a function on root:

_root.fadeBox_mc.onEnterFrame = function (){
if (fade){
this.nextFrame();[code]....

This causes a mc to fade in and out on rollover/rollout. But what I wanna make is a box that fades in when pressed on the button and fade out when pressed for the second time. But if I say

on (press){
_root.fade = true;
}

the mc fades in, but I cant do another on (press) to fade out. Is this too confusing?

View 2 Replies

ActionScript 2.0 :: Create If Statement That Would Load Movie Clip After Different Movieclip Is Loaded

Apr 19, 2004

is there a way to create an if statement that would load a movie clip after a different movieclip is loaded.i have text_mc and scroll_mc. I dont want scroll_mc to load unless the content is loaded into the text_mc.I tryed to make an if statement sort of like a something used for a preloader but I must have been off just a bit because it was not working. I dont even know if it possible.

View 7 Replies

ActionScript 2.0 :: First Requirement Of The If Statement When Type In The Proper Input And Go Straight To The Else Statement

May 14, 2009

Having a few problems with what I thought was a simple if statement. Here is the code:

[Code]...

I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.

View 7 Replies

ActionScript 2.0 :: Create A Flash Based Popup Window When A Button Is Pressed Within The Flash Movie

Oct 28, 2009

I'm looking to create a flash based popup window when a button is pressed within the flash movie. Not a javascript based html window or html browser window, but a window that is in the flash movie that is entirely flash based. I looked all over the internet and can't seem to find anything on this, and can't find anything on this board either. I am new to flash and actionscripting in general. I would also like to use the Tweener external class, or the flash tween class would work too.

View 1 Replies

ActionScript 2.0 :: Create Buttons When Pressed Load Image In Image Area Within Same Flash Document?

Jan 13, 2004

What would you use to create buttons which when pressed load an image in an image area within the same flash document?

View 1 Replies

ActionScript 1/2 :: Execute Code In Previous If Statement If Second If Statement Is Executed?

Aug 31, 2011

if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code

[Code]...
 
I dont want to copy the code from the first into the second and the first and second into the third.
 
My mind isn't working and there is probably an extremelly simple way to get this working.
 
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.

View 7 Replies

ActionScript 2.0 :: Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails?

Oct 10, 2008

The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {

[code]....

The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

View 1 Replies

ActionScript 1/2 :: Keys Pressed Or Not Pressed?

Dec 6, 2010

I am struggling a bit with keys on the keyboards controlling a movieclip to happen.Ive got a person moving when pressing right and left, and a movieclip with three frames: First frame is a movieclip with the person standing still, looking bored. The second frame is the person moving right, and the third frame is the person moving left.This is the code that Ive inserted into the persons actions on scene1:

if (Key.isDown(Key.RIGHT)) {_x += speed;this.gotoAndStop(2);_xscale = +scale;} 
if (Key.isDown(Key.LEFT)) {_x -= speed;this.gotoAndStop(3);_xscale = -scale;}
 
this code works alright accept that when the keys are not pressed it doesnt stand still, the legs are still moving, so I tried to include this code aswell:

if (!Key.isDown(KEY.RIGHT)) [code]....this makes the person standing still when not pressed but not moving the legs when turning right and left.

View 3 Replies

ActionScript 2.0 :: If Statement Inside If Statement Won't Work

Mar 30, 2011

why this code won't work

[Code]...

I'm sure you can put if statements inside other if statements, seriously I can't figure it out

View 4 Replies

ActionScript 3.0 :: Create An "if Statement" In The Next/back Button?

Feb 15, 2011

I've created next/back buttons to navigate to various frame labels on the timeline. There is a "main menu" frame that contains menu buttons to take the user to other frame labels on the timeline. However this "main menu" frame has an FLV playing and needs to be "stopped" when navigating to another frame label. I have the code for this.

What I am inquiring about is this:Do I need to create an "if statement" in the next/back button code telling Flash that if the user clicks on the next/back button while on the "main menu" frame, to stop the FLV also?

View 4 Replies







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