ActionScript 2.0 :: Flash8 If Statement - More Than 1 Conditions
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
Similar Posts:
Sep 26, 2006
if(description_1 = "HELLO" && date_1 = 1981){
do Crap()
}else{
[code]......
View 4 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
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
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
Nov 17, 2009
all i want to do is to enable a user to check that what they have written in an edit box is the correct answer or not
var element ("correct")
var element ("try again")
var element ("input") = "3"
if (input="3")
[Code]....
and what happens is no matter what is written in the edit box, "correct" shows up
View 1 Replies
Jan 7, 2007
I'm trying to use an if statement on a frame, but it doesn't seem to work do i need to put into some sort of function?
View 2 Replies
Dec 17, 2009
I defined an array construct and assigned two variables to part of the array so I can simple sort it:
number1 = array[i]
number2 = array[i+1]
if(number1 > number2){
...swap etc
Problem is, when I try the comparason if the one of the numbers has a higher digit value, it ignores the statement entirely. Eg If 16 > 8 it skips it. So I tried adding '16' and '08' into the array and that worked perfectly with the statement.
View 2 Replies
Aug 21, 2009
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.
[Code]..
View 2 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
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
Jul 21, 2004
Ok here is the problem... I have this code:
[AS]
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
[code]......
View 2 Replies
Feb 2, 2011
I ve used next script:
onClipEvent (load) {
if((_root. mc1._visible=true) and (_root.mc2=true)) {
_root.mc3._visible=true;
}else{
_root.mc3._visible=false;
}}
To achieve next: mc3 is visible only when mc1 and mc2 are visible else its hidden, but this dont work, with this script on load all clips are visible on stage mc1, mc2, mc3, inspite there is a script which is hiding mc1, and mc2...(they should appear on stage on mouse event and this was ok before a inserted script from beginning of post, now they are always visible). How should I write this to make mc3 visible only when mc1 and mc2 are both visible on stage.
View 2 Replies
Apr 21, 2011
Example of my XML list:
<listnode>
<nodeA id="1">
<nodeB id="1" />
[code]......
View 2 Replies
Aug 5, 2003
whats the format for having 2 conditions???[code]
View 4 Replies
Jul 3, 2011
I'm having some difficulties using conditions with XML and AS3.
Having something like this in my XML:
Code:
<?xml version="1.0"?>
<schedule>
<class>
<name day="monday">AAA</name>
[Code]...
View 4 Replies
Sep 22, 2010
I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.
View 13 Replies
Jul 12, 2010
what I'm trying to do is create an else if argument for each object in an array based on a user set number
Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}
to which I want it to GENERATE THE FOLLOWING CODE:
Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}
the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?
View 4 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
Nov 21, 2009
I used a tutorial to attempt to set up my code so that after a button is released and an external .swf is loaded the same button can't be activated again (on release or on rollover) until a different button is released.
Here is an example of my actionscript. What I'm trying to do here is just have the button not replay the mc in the over state if it's movie clip is already loaded in[code]...
View 1 Replies
Jun 3, 2009
I've got a function which is constantly running to see if a set of movie clips (ball0_mc, ball1_mc etc.) have been placed in a target zone. Once the ballPlaced[#] value is true for a partiuclar moive clip, the movie clip starts acting in different ways depending on which other balls have been placed in a target zone (i.e. their ballPlaced[#] value is also true).
The 'if' and 'else if' conditional statements are contained within the playVideo() function which is constantly running through the ENTER_FRAME event. [code]...
View 1 Replies
Oct 30, 2010
Depending on the time of day (user machine time) and the amount of money raised the header needs to show different scenes and building construction progress.1. Is there some example script out there that would conditionally call on 1 of 4 times of the day (morning, noon, late afternoon or overnight) for me?2. And the % of the funds raised (variable data passed from the site?) will reveal that equivalent portion of the building constructed. So if 25% of the funds are in then 1/4 of the building will be shown completed. Is there an example script that would receive that data from an external source and then call 1 of 4 pre-built building movie clips?
View 0 Replies
Apr 1, 2011
I have several input text boxes all of which are activated by the use of the enter key. I only want the one the user is using to run its script when they press enter instead of the keylistener on all of them picking up when enter is pressed. I have tried
ActionScript Code:
listenForEnterObject = new Object();
listenForEnterObject.onKeyDown=function(){
[code]....
View 1 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
Mar 29, 2012
So the way I see it, there are three conditions in a drag/drop assessment situation; The dragged object is on the correct drop targetThe dragged object is on an incorrect drop targetThe dragged object is not on any targetAssuming there are multiple drag and drop targets, I can do this, but it only satisfies the first two condition:
ActionScript Code:
function stage_onMouseUp(event:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_UP, stage_onMouseUp);
[code].....
View 3 Replies
Jul 15, 2009
I'm having a strange problem w/ race conditions when using attachmovie. I have a class linked to a movie clip that I'm attaching to the stage. The class is fired off when the movie clip is attached but also other classes are getting loaded at the same time while the movie clips is attached. Even though the other classes are called after the movieclip is attached, they are getting loaded faster and therefor the class linked to the attached movie clip cannot access their functions. I'm looking for a listener that will fire off an event ONLY when the attached movieclip is fully loaded but I can't seem to find any examples of associating a listener to a attachmovie method.
View 1 Replies