ActionScript 2.0 :: Check On More Than One Variable In An If Statement?
Sep 25, 2009
i am trying to find out if it is possible to check on more than one variable in an if statement at a time as i am usure how, so is it possible in as2 to check on more than one varialble if answer is equal to the number 1 and answer is to the number two and also the number three perform a function
var answer1:Number =1;
var answer2:Number =2;
var answer3:Number =3;
if(answer == 1 ) and answer == 2 and answer ==3);
if(answer == 1 and answer == 2)
I am trying to use a mouseevent.startdrag to move a particular movieclip, but I don't know how to go about checking the object in question. The code below doesn't seem to work with either ==Object(MCsquare) or just ==MCsquare.
function onStartDrag(evt:MouseEvent):void { trace(evt.target);
[Code]....
How can I run a check to see if the target object is MCsquare?
The user needs to submit a dollar amount answer. They could write is several ways. I'm trying to accomodate it with the code below. It always evaluates it as the wrong answer (the else).
I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.
The first vid node contains a path to a logo graphic, I then need to check in my ActionScript if there is a logo there or not, and to do something if there is(display the logo) I can trace out the logo path so I thought I could run a simple if/else to check if there is anything in that node and if so to do something:
private function thumbOver(e:MouseEvent = null):void { trace(" ");
[code]....
Now I've tried everything, but it will always trace out "Does have a logo" no matter what I do. I tried:
if (tabData[tabID].video[e.target.id].@logo == "") if (tabData[tabID].video[e.target.id].@logo == null)
Just starting to delve into as3. I have made a flash website with four navigation buttons (home, products, about, contact). When user clicks on "products", an external movie clip is loaded and everything works fine. User clicks any button after that, and myLoader.unloadAndStop, the swf is removed when you navigate away from "products". However, if the "home", "about", or "contact" buttons are clicked first (before the external swf has been loaded), it of course, throws the 1009 error.I need some sort of if/else statement to check whether or not the external swf is loaded, remove it if it is, and if not, just navigate to the "page" clicked.[code]
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?
In a setup like this is it possible to check the cumulative status of all onLoadInit?
for(var i:Number = 0; i < limit; i++) { var mcLoader:MovieClipLoader = new MovieClipLoader(); var mclListener:Object = new Object(); mclListener.onLoadInit = function(mc:MovieClip) {
[Code]....
Initially I was thinking that I could pass an array of Boolean's, but I'm not really sure where to add that checkpoint, because a flash frame doesn't keep looping. Would I have to add it to an onEnterFrame()?
This may be an obvious search, but I'm not totally sure on the proper syntax... basically what I want to do is:
private function makeISchedule(data:Array, label:String = null):ArrayCollection{ var arr:ArrayCollection = new ArrayCollection; for (var i:int = 0; i<data.length; i++){
What i am trying to attempt here is to make the variable equal to the name of an item in my library. (Im using this to use different ships in an old arcade-style vertical shooter). This is meant to make a ship appear on stage.
When <variable> is replaced with a library item (eg. mvcShip), it works fine, but if the variable is in place, i get a trace value of ship1 as "undefined", and the ship doesnt show up on the stage.
I have a movie clip on the main timeline that includes a button.When pressed, I want this button to conduct an if statement to check the contents of a textbox on the main timeline and if equal execute the statement.So far I have this but the text does not seem to 'read'. Do I need to pass the textbox contents into a string variable rather than read directly from what is in teh text?[code]
if I use in statement xml-child distinct of nameWin (summa, e. g.), it works good. But with nameWin, e4x compares local variable nameWin (which not interested for me at all at this time) with "necessary name" instead of compare item's nameWin with "necessary name".
How can I test a undefined variablewith an if statement.all a this did not work and I don't want to define a value for this variable.name of the variable x.
i'm trying to use if statements but can't get this thing to work i want to check if another button is visible on release of a button to determine what action to be taken.the 'gotoAndPlay("firstscene",1)' is just there as an outcome, will be changed later. anyway this is the code i've got on the button i'm pressing. blobyellow2 is an instance of a button blobyellow is it because it's an instance that it's not working?
[Code]...
edit: sorry forgot to put what's wrong with the code. it acts as though the statement is correct no matter if it is or isn't.
i have "roll over" event listener and i would like to that works only with MovieClips (without textfields etc.). I would like to write something like that:
if(event.target == MovieClip){ do something } else { do something else}
This doesn`t work properly.
How to check type of event.target in "if" statement?
In my movie I load a swf to a movieclip with this code
PHP Code:
_root.ImageViewer.loadMovie("deneme.swf");
Now can I do this? before calling the swf named deneme. When I press a button If I attain a number to a global variable with this code
PHP Code: on (release) {_global.myVar = 5;gotoAndPlay("CloseUpAnimation");}
Can I read this variable from the swf which I load into my movie?If I can read how can I write a If Statement that will gotoAndPlay according to that variable?
I have 'Sound On' and 'Sound Off' buttons on mutiple scenes and I am playing the music loop in my flash movie by loading an external swf. When I move to the next scene the sound reloads which I do not want. How do I use an if-statement that checks whether or not the music.swf, that needs to be loaded is found and when it is found, go to a frame?
Given this: if(myVar){}, what will pass as true or false?In JavaScript for example, false are values like null, undefined, 0, '' (empty string), false.
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
This shouldn't be too difficult. Heres my code: for(i=0; i<30; i++){ var box[i]:Object = new Object() box[i].id = [i] box[i].name = "default" box[i].location = "default" box[i].type = "default" But its not working. I keep getting error messages concerning the var box[i] statement.
I have a for statement, using an incrementing variable "a." A dynamic amount of herbs are generated, so here is the for statement. Code: for(a=1; a<_global.herbAmount+1; a++) { var herbMC = _root["herb"+a]; trace(herbMC); } When I trace "a," it traces 1, 2, 3 or however many numbers there are up to the global herbAmount number. When I trace _root["herb"], _level0.herb pops out. When I add "a" onto _root["herb"], undefined is traced....why?
I am trying to get a high score table set up and I have it all working except for an if statement which decides whether to put a zero in the time or not. ActionScript Code: variable declared at the top var gap:String;
This is getting data that is stored - it works fine except for the underlined "gap" - The "gap" is meant to be calling the variable which has the below if statement ScoreInputScore.text=String(SpotTheDifferenceGame._minute)+gap+String(SpotTheDifferenceGame._second); if (SpotTheDifferenceGame._second<10) { gap=(":0"); } else { gap=(":"); }
I thought by have the variable called in in the function and having the if statement with gap= it would do the specified text in the dynamic text box. When I put a trace on "gap" it traces with the correct text depending on what the number is but in my dynamic text box it displays as number null number. // displays like this when trace put on it :0 // displays like this in dynamic text box 2null02
I am trying make a movieclip pan across the stage on a set path, I have 5 buttons, when button 2 is clicked, the movie clip is moved to position 2, its moved on a timeline so a function starts playing the movieclip, on the timeline inside this movieclip there are conditions on specific frames showing where the the timeline stops, so when button2 is clicked a variable is created which is "label2" and the timeline stops on this point, as seen the the condition below[code]....