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


Similar Posts:


ActionScript 2.0 :: Statement Must Appear Within On Handler?

Jan 29, 2010

I have been asked by a local web development company to code some flash banners for use with there banner ad site they are doing. I have been sent a banner to add the actionscript and also the actionscript as well. What I have is a fla doc with a button that covers the whole banner. Then on the banner I have this actionscript:-

this.masterButton_but.onRelease = function(){ if (root.Hyperlink != null){ getURL(root.Hyperlink); }else if(root.clickTag != null){ getURL(root.Hyperlink); }else{ getURL("http://www.greatrun.org/Events/Event.aspx?id=3"); } }

When I test it the compiler errors and says in the description "Statement must appear within on handler".

View 1 Replies

ActionScript 1/2 :: Statement Must Appear Within On Handler

Mar 12, 2009

I keep getting the "statement must appear within on handler" error when I try to add a gotoAndPlay event to my button...

View 3 Replies

ActionScript 1/2 :: Statement Must Appear Within On Handler?

Mar 20, 2012

I am getting

Symbol=page5, layer=Layer 1, frame=1, Line 1Statement must appear within on handler my action in actionscript is
 
getURL("http:url.....)

View 5 Replies

ActionScript 1/2 :: Using Variables: Statement Must Appear Within On Handler

Jun 30, 2010

I would like to use variables in my flash app. The app is quite simple, has many buttons, and on each of those buttons I have a simple script: on-rollover and on-release. For both actions I use the same value, which I want to put in a variable. The following script results in an error message: Statement must appear within on handler. When I have to declare the variable inside the on-handler, I have to declare it twice, which makes it useless as I have to enter the value twice. How can I get this working?
  
country = "uk"
on (rollOver){    gotoAndPlay(country)}
on (release){    getURL("/"+country+"/", "_self");}

View 1 Replies

ActionScript 2.0 :: Statement Must Appear Within On/onClipEvent Handler?

Jan 4, 2009

I am just learning Flash. I'm using Flash CS4, However I am using Actionscript 1.0/2.0. I have a main page with just simple buttons, and such. My question is, I need to load a swf within my main page. I have a sqaure in the center of my page that I want to load a swf in. I made a rectangle using the rectangle tool, and converted the rectangle into a symbol so that actions may be placed within it. I want to load a file called News.swf within the rectangle. I can't find any code to do this that doesnt have compiler errors.

I found one code: News.loadMovie("News.swf"); when I put just that in the Actions field, and I export the movie I get the error: Statement must appear within on/onClipEvent handler

I just want to load News.swf in the actions tab within a symbol.

View 9 Replies

ActionScript 2.0 :: Statement Must Appear Within On Handler Error?

Sep 1, 2010

novice AS coder, trying to get a simple flash form to submit data to a php script, then get data back from the script.the "send" button has this code:

on(release) {
//assign user-input value to lv property called years
lvOut.years = years.text;

[code].....

View 1 Replies

ActionScript 2.0 :: Back Button - Statement Must Appear Within On Handler

Oct 22, 2003

This is what I get in the output window:
Statement must appear within on handler
back_button.onRelease =function () {

View 6 Replies

ActionScript 2.0 :: Error: Statement Must Appear Within On/onClipEvent Handler

Jan 16, 2008

[FlashCS3-AS2.0]i'm getting continuous errors of: ''Statement must appear within on/onClipEvent handler''On one .swf the script is working fine, but on 3 others im gettin 9 error messages on each.

I have entered the script on the 'Frame' on every scene, including the one that worked.Heres the script:

var groupinfo:Array = [intro, menu, modern, street, freestyle];
var activebtn:MovieClip;
function grow() {
if (this._yscale < 180) {

[code]...

View 3 Replies

ActionScript 2.0 :: Button Script (Statement Must Appear Within On Handler)?

Oct 22, 2003

This is what I get in the output window: Statement must appear within on handler back_button.onRelease =function () {

View 7 Replies

ActionScript 2.0 :: Calling External .SWF - Error Saying "Statement Must Appear Within On/onClipEvent Handler"

Sep 18, 2009

I am trying to call an external .swf and it does not seem to be working. I have read a few other posts with no luck. I have a small calendar that flips and at the bottom i have a link to another. So i put an empty MovieClip on the following frame. the button directs me to the empty frame where a pre-loader should start, but nothing happens. here is the code i last tried:

[Code].....

I am getting a compiler error saying "Statement must appear within on/onClipEvent handler" I am also trying to link back to the original .swf from the loaded .swf would anyone know how to do that?

View 7 Replies

ActionScript 2.0 :: Event Handler Not Working?

Jul 17, 2009

I'm using a progress bar component in a movie clip and this progress bar works loading an external movie clip. However, once the external clip is loaded, it seems the "complete" event is not registering with the object listener. This is what I have:

ActionScript Code:
this.createEmptyMovieClip("FOB", _root.getNextHighestDepth());
var progressBarListener:Object = new Object();[code].......

The code a little more complicated than this in that there is an array that stores some information and a setInterval command that calls the loadContent function loading each external movie clip. I can past the entire code if necessary.Also the progress bar component is set up as thus: in the main movie (root) there is a movie clip called progressBar. Within progressBar the component resides with a variant name of PB.For some reason, when the external clip is finished loaded, the progressBarListener doesn't seem to be called.

View 1 Replies

ActionScript 3.0 :: Tween Not Working When Within TweenEvent Handler

Jul 19, 2007

I have an interesting problem here that I can't figure out. Here's the problem: This code works:

[Code]....

As you can see, I want the object to move in the x direction, then once it's done that I want it to move in the y direction instead of just doing both at once and going diagonal. One thing that is "interesting" is that the trace still spits out the word to the output window. But the object in the end has only moved to the x destination and never gets to the y.

View 3 Replies

Actionscript 3 :: Global Error Handler For Flash Player 10.1 Not Working?

Jul 23, 2010

Trying to implement the new FP 10.1 Global error handler into my projects but no matter what I do any uncaught error will still show up the Exception window (both in debug and release versions of the SWF). All I want to do is to prevent these popups but instead send a message to my logger. Here's my code ...

EDIT: I simplified the code now. Could somebody do me a favor and test the following class and see if it's works for him? Because it's doesn't for me! ...

package
{
import flash.display.Sprite;
import flash.events.UncaughtErrorEvent;

[code]....

View 4 Replies

Data Integration :: SetSelectedIndex Not Firing Change Handler

Sep 12, 2006

Is the Change handler supposed to fire when setSelectedIndex() is called?

After adding a line of code to the Bike Trips example I found this problem. I added a button and the line to it:

on (click) {
_parent.cbTrips.setSelectedIndex(3);
}

My Example and
FLA

I want the bound data to change but it doesn't.

View 4 Replies

ActionScript 2.0 :: Change Event Handler And Combo Boxes?

Jan 20, 2009

I'm currently using the change event handler to detect any changes made to the combobox selection, however, I would like it to ignore when the arrow keys are pressed as I am using them elsewhere.

View 0 Replies

ActionScript 2.0 :: Event Handler Change Button Color For A State?

Feb 18, 2002

I am trying to figure out a way for an action script to change the background color of a particular button state.

I have a puzzle graphic. As the mouse moves over the pieces of the puzzle, the colors change. When the mouse clicks on the puzzle piece I want them to permanently change. However, I cannot figure out how to access the bgcolor property of a button state object, such as the up state.

View 4 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 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

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







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