ActionScript 3.0 :: Simple If Statement Not Working?

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


Similar Posts:


ActionScript 2.0 :: Can't Get A Simple If/then Statement Working With An Input Text

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

ActionScript 2.0 :: Simple If Statement Won't Work?

Feb 18, 2006

I am using Flash 8, and for some reason, my if statement won't work. I have a scrollbar which scrolls a movieclip (that contains AS loaded material (eg. attachmovie). I want it so that only when the material is longer than the scrollbar do I see the scroll bar.For some reason, it doesn't work. The traces don't even work!

if (scrollbar._height < menu_mc._height) {
scrollbar._alpha = 100;
trace("works");[code].....

View 2 Replies

ActionScript 3.0 :: Simple Hide / Show Movie With If Statement?

Nov 24, 2010

I need something like this (not correct code!)

if (MovieClip(this.root).myimage.x -= 100{
MovieClip(this.root).mybutton.visible = false;
} else {
MovieClip(this.root).mybutton.visible = true;
}

So I'm saying if myimage x position in less than 100 hide mybutton.

View 6 Replies

ActionScript 3.0 :: Check To See If An Object Exists By Using A Simple If Statement?

Sep 27, 2010

I'm trying to check to see if an object exists by using a simple if statement.
 
if (object.name) {
//Do this
}
 
However, if the object doesn't exist, I get this error, "Error #1010: A term is undefined and has no properties" - which I understand is because the object doesn't exist. Is there a better way to check to see if an object exists?

View 1 Replies

ActionScript 2.0 :: Simple Timer - Delay For 20 Seconds (IF Statement)

Apr 19, 2004

I'm building a continous move in flash, and I'm displaying some text and images and want to hold the timeline for about 20 seconds and then resume play again. I'm trying to write a simple timer in AS to keep from having to create 10000 frame long movie clips. Here's what I have so far:

stop();
this.onEnterFrame {
time = getTimer();
if (time == 20) {
play();
}}

Unfortunately, this isn't working for me, and 'm unsure why. I suspect two things,
A: my "time" var takes only a snapshot value of the timer and not a continuous value, so the timer never reaches the value of 20. Or,
B: I have somesort of syntax wrong and the if never gets a chance to load.

View 4 Replies

ActionScript 2.0 :: Make A Simple SWITCH Statement With Button._name As Variables?

Jun 18, 2007

I want to make a simple SWITCH statement with Button._name as variables for CASE

so i got this code:

Code:
Button.addListener(_root);
_root.onRelease = function() {

[Code]....

View 2 Replies

ActionScript 2.0 :: If Statement Is Not Working?

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

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

ActionScript 3.0 :: If Statement Not Working/being Run?

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

ActionScript 2.0 :: If Statement Not Working?

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

ActionScript 2.0 :: For Statement Not Quite Working?

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

ActionScript 2.0 :: Else If Statement Not Working?

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

Actionscript 3 :: Conditional Statement Not Working?

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

ActionScript 3.0 :: Switch Statement Not Working

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

ActionScript 2.0 :: Conditional Statement Not Working?

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

Actionscript :: Switch Statement Not Working In Flex?

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

ActionScript 2.0 :: Use Switch/case Statement Instead Of If/else But It's Not Working?

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

ActionScript 2.0 :: If Statement Not Working To Verify Password

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

ActionScript 3.0 :: Movieclip Focus Not Working On If Statement

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

ActionScript 3.0 :: SW1 Change Handler - IF Else Statement Not Working

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

ActionScript 3.0 :: Referencing Function With If Statement Not Working?

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

ActionScript 2.0 :: If Statement Not Working Properly [renamed]?

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

ActionScript 3.0 :: IOErrorEvent Try Catch Statement Not Working

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

ActionScript 3.0 :: False As Part Of If / Else Statement Is Not Working In IE?

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

ActionScript 3.0 :: Referencing Function With If Statement Not Working

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

ActionScript 3.0 :: Movieclip Focus Not Working On If Statement?

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

Actionscript 3.0 :: Get An "if Statement" To Run A Simple Function?

Jul 8, 2009

I am trying to get an "if statement" to run a simple function.

View 5 Replies

ActionScript 1/2 :: Conditional Statement Not Working Properly On Button?

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

ActionScript 3.0 :: Timer Function - Trace Statement Not Working

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







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