ActionScript 1/2 :: If Else Statement Not Working
Jul 30, 2009
I'm sure I have the conditions and statements typed in wrong. Here is the original code:[code]only now I want to add an if/else statement so that if none of the mouseDown conditions are met, it then goes the the Timeout variable:[code]
View 2 Replies
Similar Posts:
Jun 22, 2010
on my main timeline i have a movie clip called "screen" within that i have a dynamic text box for inputing a number. var for text box is txt_1
on the same timeline i have another mc called "animation" withing that i have a mc called "prizes" there are 2 animations in the prizes movie clip that are supposed to run based on the if statement...i have an action assigned to the prizes as below:
//this.onEnterFrame = function () {
if (_root.screen.txt_1 == "11111") {
prizes.gotoAndPlay('prizes1');[code]........
but this is not working...basically i want to say that is the text that was inputed was "11111" play the first prize animation inside the "prizes" mc, and if its "22222" play the second prize animation in the "prizes" mc.what am i doing wrong?
View 7 Replies
Nov 25, 2009
I have a button which makes a panel flip 180 on the x axis if its name is not in an array called "panes", it determines this by running an if statement. If its name is in the array then the button should run some code to make the panel flip back. However it isn't. It will let the panel flip one way, but doesn't run the code to flip it back. I was wondering if someone could take a look a see if they know why.
View 4 Replies
May 28, 2005
For some reason my if statement is not working. It is in a movie clip of a blinking eye and I want the code to pause the blink for 4 seconds between blinks.The movie clip does not have an instance name (which may be the problem).Frames 1-12 is the eye blink animation. (no script)
Frame 13
Code:
timeDelay = 4+getTimer()/1000;
Frame 14 is empty
[code]....
When I run the movie, the varaibles change like they should according to the time, but for some reason, it skips over the if statement even is timeYet is greater than timeDelay. I probably labeled the variables wrong, but I do how they should be.
View 2 Replies
Jan 4, 2006
ActionScript Code:
</p>
<p>function flasher () {</p>
<p> trace ("flasher running");</p>
<p> count = 20;</p>
[code]....
If i am right this should make win11 flicker 4 times but it aint:confused: I dont need to use a onEnterFrame for this do i?
View 14 Replies
Aug 9, 2006
Here's my code:
Global variable _level0.menu_2 is populated with one of 5 values. Function exists for each value. The function for the value should only be called if the _level0.menu_2 variable matches the value. What is happening is that even though _level0.menu2 is correctly populated, only the first if statement executes--even if the first condition is NOT met.
I looked all around and can't figure out what's wrong. As far as I can tell (and I've been over the code character for character) the syntax is correct.
function loadMenu2():Void{
if (_level0.menu_2 = value1){
trace("_level0.menu_2 is value1");
value1();
[code]....
View 2 Replies
Jan 23, 2010
In my code here:
var manTimer:Timer = new Timer(1700,5);
manTimer.addEventListener(TimerEvent.TIMER, moveMan);
function moveMan(e:TimerEvent):void {[code].....
I am trying to get it so that when btnElScorcho or btnTheGoodLife is clicked it'll move my "man" mc out onto the stage. It starts at 590px and ends at -10px. That part is working.What is not working is my conditional statement that tells it to only move the "man" if he is at the x position of 590 or greater, because, when one of the 2 buttons is clicked again, I don't want to move him out if he is already there or if he is already moving out.So for some reason, "man" will still move when the buttons are clicked a second time and oddly enough, "man" will only move twice as opposed to the normal 5 times set in the function.Maybe I can change the if statement to check if the button has already been clicked as opposed to where "man" is?
View 1 Replies
Nov 5, 2009
I have the following in my script:[code]where eProp is an Array.Tracing the eProp[3], shows the correct number (1 or 2) but the statement always jumps to the default part!In other words: If eProp[3] is 1 or 2, the switch do nothing, jumps to default.[code]What is wrong? AS can't evaluate Arrays? Or I did something wrong?
View 3 Replies
Feb 21, 2012
I am attempting to create one function to respond to multiple button clicks. I have a simple if statement in my onBtnClick function that does not work. Just need the button that is in that variable to go to frame 1. Trace statements are working inside the statement so I the if statement runs correctly?
[Code]...
View 3 Replies
Jul 31, 2008
In the code below i can't seem to get the second conditional statement to work.
on (press) {
startDrag(this, true);
}
on (release) {
[Code].....
View 3 Replies
Mar 5, 2010
I have a students xml from a database. The student_state column can have a value of "passed", among other values (hence the need for switch statement). When the list_changeHandler function is called, depending on the value of student_state, I want a form to display different fields. So I tried to dynamically create the form in actionscript, but it fails to show up when I run the flex application:
import mx.containers.Form;
import mx.containers.FormItem;
import mx.containers.HBox;[code].....
View 3 Replies
Jan 16, 2009
I'm trying to use switch/case staement instead of if/else but it's not working. Here's the code.
ActionScript Code:
//working code
function checkTarget(drag){[code].............
View 3 Replies
Nov 4, 2009
I am a total newbie and just learning from resources available here.. Today i was trying If statements to verify if the password entered in input box named "pass" . I code is as following..
on (release){
if (pass =="acc"){
gotoAndPlay(10);
}else{
gotoAndPlay(15);
}}
Even if I enter the correct password it displays the content in frame 15.
View 9 Replies
Jul 7, 2010
I have created menu which has roll over and out animations.What I am trying to achieve is to play the roll over animation when rolling over the menu, but stop the roll out animation IF the focus has been set on a specific movieclip.[cod]I am not sure what I am doing wrong, but if I trace the stage focus inside the if statement nothing happens, but it works if I trace it on else statement(gives null) which means that the if statement is bypassed and the else is played.
View 7 Replies
Nov 21, 2011
sw1 = text input
asw1 = text input
My problem is that is sw1 when I put in "188" it gives me "28.73" instead of "209.43". If I put in "2" it gives me "28.73" instead of "21.78". So it really doesn't work. My other "If" "Else If" statement works.
Code:
protected function sw1_changeHandler(event:TextOperationEvent):void{
// TODO Auto-generated method stub
if (sw1.text <= String ( Number("18.325")) && sw1.text >= String ( Number("1"))){
(asw1.text = String ( Number("21.78")));
} else if (sw1.text <= String ( Number("24.83")) && sw1.text >= String ( Number("18.326"))){
[Code] .....
View 5 Replies
Jan 10, 2005
I am trying to reference a function in an if statement and it's not doing anything. The reference is here.
Code:
private function newNumber (qTotal:Number, curNum:Number):Number {
var newNum:Number = Math.floor(Math.random()*qTotal);
[code].....
View 1 Replies
Dec 16, 2005
For some reason my first if statement is allways fulfilled, even when I set the varaiable to different values, I cant work out why. My variables are not used anywhere else in my site.
_global.roller=0
if (_global.roller=5){
var speed = 0;
}
[code]....
View 4 Replies
Sep 24, 2009
I have a picture loader to load pictures on a website I am making and I want it to check for a picture and if the picture is not at the url, I want it to run a function and not throw an error. I tried using try catch but it didn't work so I tried using an IOEventListener and that still didn't work.
View 2 Replies
Oct 10, 2009
i have made a navigation banner in flash for a blog site, but the banner is giving me trouble in Internet Explorer. The Flash file has two buttons, one for "Log In" and one for "Log Out", that are supposed to be visible/invisible depending on whether or not the user is logged in to the blog or not. To achieve this, I have set up a Param tag that checks to see if the user is logged in or not, and then reports this true or false data to the Flash movie as being either "1" or "0" in the form of a variable. The Actionscript in Flash then uses this data to make one button visible, and the other not visible.This is working perfectly in Firefox, but for some reason in Internet Explorer (tested in IEv8) both buttons are visible at all times. Both Firefox and Internet Explorer are running the same version of FlashPlayer (v10).[Code]...
View 5 Replies
Apr 30, 2010
I am trying to reference a function in an if statement and it's not doing anything. The reference is here.
Code:
private function newNumber (qTotal:Number, curNum:Number):Number {
var newNum:Number = Math.floor(Math.random()*qTotal);
for (var j:Number=0; j<curNum; j++) {
[Code]....
View 5 Replies
Jul 6, 2010
I have created menu which has roll over and out animations. What I am trying to achieve is to play the roll over animation when rolling over the menu, but stop the roll out animation IF the focus has been set on a specific movieclip.
Here's my code:
Code:
function menuOut(e:MouseEvent):void
{
stage.focus == contentMc;
[Code]....
if I trace the stage focus inside the if statement nothing happens, but it works if I trace it on else statement(gives null) which means that the if statement is bypassed and the else is played.
View 1 Replies
Nov 25, 2009
Here is my current small piece of code I have on a given "letter" button..
on (release) { if (_root.Acheckmark._visible=true) { _root.AScore = _root.AScore+_root.APoints; } else if (_root.Bcheckmark._visible-true) { _root.BScore = _root.BScore+_root.BPoints; }}
View 1 Replies
Oct 23, 2009
I am having a problem with the if statement in my timer function, the trace statement within in it is not working, eventually I wanted to use this if statement further but need to make sure it is working first.
Code:
timerFunction();
} function call in function above
function timerFunction() {
trace("hey");//this trace works
var myTimer:Timer=new Timer(1000,15);
[Code] ......
View 8 Replies
Jan 27, 2009
I am new to actionscript and just like some of you, I would like to start off on the right foot. After several attempts to solve this problem I am now taking a break and reaching out to those in the community. I have created a .as file named Main.as and the code inside main.as is:[code]then i created a new fla file and named it testas. I then typed Main in the Document class under properties.The code has no errors and when I attempt to test the movie, there is no output to the output panel.
View 7 Replies
Feb 19, 2005
i cant seem to get a simple if/then statement working with an input text. Here is my AS
[AS]
on (release) {
password = inputName
if (password == "test") {
[Code].....
For some reason when i type in test in the movieclip inputName it still sends me to ign.com. Everything is in the same frame and i just cant get it working.
View 1 Replies
Dec 10, 2005
I have a movieclip with the instance name information_mc. I am trying to get this movieclip to move up and down, depending on its y co-ord or in what direction it is tweening at the moment it is clicked.I have the following AS:
Code:
information_mc._y = 240;
var curMovement:String = "goingup";
[code]......
View 2 Replies
Oct 28, 2002
I have the following which works fine just out side of the loop statement:
loadMovie("icons/test.jpg", "pIcon0.Icon");
But inside the loop statement no image shows up.
I need it in the loop statement because eventually the code will call the jpgs out of an array based on the loop variable. And put them in a movieclip number by the variable also.
View 1 Replies
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
Nov 25, 2011
This is an if stament on a frame on the root. I want to loop Carrera(a lenghthy movieclip) from frame 2 back to frame 1. (For testing purposes) This is the code:
[Code]...
View 3 Replies
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