ActionScript 2.0 :: If Statement With Multiple Conditions?
May 18, 2005
I want to set multiple conditions for an if statement, but I don't want the conditions to all have to be true, I want to say if (a or b or c or d, etc. is true) then do this. I don't want to say if (a && b && c && d, etc. is true). Is it possible to have an if statement with an "or" in the condition? If so, what's the proper syntax for that?
View 1 Replies
Similar Posts:
Jul 8, 2009
This is my code
Code:
if (mp1._y != 555) {
new Tween(mp1, "_y", Strong.easeOut, 650, 555, .5, true);
how/where can I ad a second condition like
Code:
mp1._alpha!=100)
to that same statment before that tween plays
View 2 Replies
May 18, 2005
I want to set multiple conditions for an if statement, but I don't want the conditions to all have to be true, I want to say if (a or b or c or d, etc. is true) then do this. I don't want to say if (a && b && c && d, etc. is true). Is it possible to have an if statement with an "or" in the condition? If so, what's the proper syntax for that?
View 1 Replies
Mar 13, 2002
I have a button that I want to play first one frame label in a movie clip, and then another, depending on a variable.
The problem that I am having is that the movie does not wait for the first part to finish before jumping to the next.
Here is an example of the code
on (release) {
if (_root.busMove.bus == 2) {
_root.busMove.gotoAndStop ("A2beg");
_root.busMove.gotoAndPlay ("Bbeg") ;
}
}
It goes right to Bbeg, flickering briefly over A2beg which will not do!
View 10 Replies
Sep 26, 2006
if(description_1 = "HELLO" && date_1 = 1981){
do Crap()
}else{
[code]......
View 4 Replies
Mar 13, 2009
Is there a way to have more conditions in an "if" statement? For example I have 3 conditions:
condition 1: a=5
condition 2: b=3
condition 3: c=12
So, if a=5, b=3 and c=12, I want to trace("success") for example. But it's necessary that all 3 conditions are executed. How can I do that?
View 2 Replies
Aug 12, 2009
i have an if statement, an object will go to a new frame if multiple buttons are pressed
PHP Code:[code].....
now i want it so that if one condition is met the mc will goto frame 2, if 2 conditions are met, frame 3 and if 3 conditions are met, frame 4.i know i could do this with a lot of if statements but i have a lot of movie clips to use this code on, so is there any way to write an if statement that will trigger different options if multiple conditions are met?
View 4 Replies
Jun 10, 2009
I've created a simple drag n drop activitiy but there is a small problem. There is a repeat of a word within the activity (the words are the drag objects). Now I want the user to be able to drag the first instance of the word onto either drop target when it first appears. When the second instance appears I have told the expression to look to confirm the location of the first instance of the word (which target it sits within) and make the word snap back if the user drags the word onto a drop target where the first instance already sits - and allow it to snap to the drop target where the first instance does not appear. (I HOPE THIS MAKES SOME SENSE) - if it does not make sense, I have cut and paste the script below:
[Code]...
View 8 Replies
Jul 26, 2009
I've got two functions that work separately, but don't like to work together. Specifically, function "onEnterFrame" stops working after function "connectT."
function onEnterFrame(){
connectT();
checkBounds();
}
[code]....
View 7 Replies
Jun 15, 2011
I have some code that needs to read like the following:IF the original position(origX) DOES NOT EQUAL where my object is(this._x) AND delay variable(delay) is set to 0, then I need to display a movieclip. There is an X on the movieclip so users can close it, and when they click the X, the delay variable is set back to 1, so the movieclip won't keep loading.
ActionScript Code:
var delay = 1;
if (origX == this._x && delay == 1)
{
[code]....
View 4 Replies
Apr 6, 2010
Is it possible to have multiple conditions within a FOR loop ?
Code:
for (var i:Number = 0; (i < anArray.length & aBoolean = false); i++) {
trace("woah, this worked!");
}
So the loop carrys on as long as 'i' doesnt exceed the length of the array AND a Boolean remains false.
View 3 Replies
Dec 31, 2007
I have this switch here .. which doesn't seem to be working..
Code:
Power = 100;
switch(Power){
[code]....
View 4 Replies
Feb 1, 2010
If I have one parent class that instantiates 5-10 different child classes, each of which need to load multiple assets etc, how can I check within that parent class to make sure all of the 5-10 children are loaded & ready to go before telling the program to continue?
The tricky part is that the exact number of those 5-10 classes that are instantiated is determined at runtime, so I can never be certain which I should be waiting on and which not to be waiting on. And just to be clear, these are different modules of sorts, not multiple instances of the same exact class.
View 3 Replies
Jul 7, 2010
I am trying to filter xml data based on a varying amount of factors, both category and range (code below). Is it even possible to put more than one conditional statement in an XML filter?
Code:
var l_results:XMLList = xml.products.product;
// testing
currentRanges = ["floss", "envy", "cool", "moon"];//
[Code]....
View 1 Replies
Nov 6, 2009
Can you use multiple conditions in a for loop?
For example, I am trying to attach images 1-6 to a specific movieclip, and images 7-12 to another and so on.
So my logic was to do this:
for (i=1; i<=6; i++) {
container.attachMovie("thumb"+i,"thumb"+i+"_mc",i) ;
}
for (i=1: i>6 && i<13; i++) {
container2.attachMovie("thumb"+i,"thumb"+i+"_mc",i );
}
But it's not working. Ony the top loop works.
View 1 Replies
Jun 3, 2003
How can I put multiple conditions into an IF block? I have tried the following and it doesnt work ;[AS]if(_root.neo.hitTest(_root.camera2)) & (camera2Off = true){[/AS] I have also tried two &'s but that doesnt work ether
View 1 Replies
Mar 29, 2011
I have a code with statements like this
Code:
mc1.onRelease= mcfunction
mc2.onRelease= mcfunction
mc3.onRelease= mcfunction
mc4.onRelease= mcfunction
[Code]....
Is there a way to cut down the number of statements in this case?
View 4 Replies
May 7, 2009
I'm trying to declare a few variables in a for statement using the variable in the for statement. In older flash versions I would use something like this.
Code:
for(a=0;a<10;a++) {
_root["variable"+a] = "Some text "+a;
[code].....
View 3 Replies
Dec 11, 2009
I am trying to do a multiple if statement checking to determine which frame label within a MC (NE) and is located on frame 3 of the main timeline, to display. In the main timeline frame 1, I have declared a new var:
var n_e;
button1.onRelease = function (){
n_e1 = 1;
main timeline go to and stop at frame 3
}
[Code] .....
But it doesn't seem to work, and most of the time it lands up on Ne("2") instead...
View 6 Replies
Apr 5, 2011
I'm afraid I know the answer but I wanted to check first.
I want to run a single function based on multiple values.
[Code].....
View 2 Replies
Oct 27, 2009
I have a conditional statement (if) that I am trying to use contingent on multiple variables being true. So the AS I have right now is:
[Code]...
But when I run that I get the following error message: "Error 1050: Can not assign to a non reference value" What do I need to change so that once 1,2 and 3 have been visited visitComplete is set to true?
View 3 Replies
Sep 5, 2005
I want to make a function that will remove every single mc symbol I've previously attached to a "mask" movieclip. So i created this:
removeAll = function(){
for(a in _root.mask){
a.removeMovieClip();
}
}
I thought if i do that itll remove each "a" it encounters but I guess I'm missing some part of that "for..in" syntax. Not sure how that works.
View 1 Replies
Aug 29, 2009
I have a menu movieclip and an externally loaded swf on my main stage. The menu mc needs to control the externally loaded swf. For example the swf plays and pauses, then when any of the menu buttons are clicked the swf needs to play thru and be removed. currently I am dispatching an event for each button clicked with a switch statement. In the main timeline I need to listen for each of theses events and based on what button is clicked proceed to the correct content frame. How can I listen for different events and run one function that based on which event is registered perform a task with a switch or if statement?
View 4 Replies
Jul 30, 2006
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.
View 2 Replies
Dec 12, 2010
Where and how I'd put the rest for the score tracker? I'm going to be making 3 of these multiple choice questions, so what would be the best way I lay that out and transition from one question to another?[code]...
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
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
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
May 2, 2011
The following doesn't work (although it gives no explicit error), but why not?nd... Is there really no way around it, strictly using the with statement? Forget using for / foreach.
with (object1, object2) {
attribute = value;
method();
}
Why the code above gives no syntax error, doesn't work but is accepted by with?If it's possible, how could we change multiple objects with same attribute using with?
var object1 = { attribute: 3 };
var object2 = { attribute: 2, method: function() { alert('blah'); } };
var object3 = { method: function() {alert('bleh'); } };
[code]....
View 2 Replies
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