ActionScript 2.0 :: Concatenate Two Strings As A Condition In A Case Statement?
Jun 14, 2010
I can't for the life of me come up with anything that works...
function setCurrentCMI(id){
if (_level0.strInteraction+id==""||_level0.strInterac tion+id=="undefined") {
//does nothing, user hasn't been here yet
[code]......
View 0 Replies
Similar Posts:
Jul 10, 2004
How do I exit a script in case a condition is f.ex. true ? Let's say I have following script:
on (release) {
if (!psw2_fla) {
inf= "Insert password !" ;[code]......
View 7 Replies
May 18, 2002
Is it possible to have more than one condition on an if statement?eg. if something is black and if it is 40cm then do the following..both conditions must be fulfilled before the action can occur.
View 3 Replies
Jan 21, 2012
Is it possible to use a for loop within an if condtional statement? I have been trying but just get errors no matter what I do. I have a series of buttons that pop up in a window and I want to make it so a click anywhere outside of the buttons will close the pop up window. I have been doing this by running a hitTest that checks if any of the buttons are being touched one at a time. It works, but it seems overly tedious, especially since there are a lot of buttons. I do not want to put the hitTest on the background of the window because it will cause the mouse cursor to turn into a hand even when it is not over one of the actual buttons.
If the for loop can't be within an if condition, then maybe there is a better way to use the hitTest code, but I couldn't figure that out either. Here's a simplified version of what I have now (it works, but is too much code..):
[Code]....
View 6 Replies
Feb 17, 2011
Look at this code:
var a:Number = 1;
var b:String = "hello";
if (a == 1 && b == "goodbye") {
trace("options a and b");
}
The book I am reading says: "In this example, the test would evaluate to true, because one of the two conditions (the first) is true. As a result, "option a or b" would be traced."Isn't the above statement incorrect? this if statement to me reads as "if a is 1 and b is goodbye THEN output it"
View 3 Replies
Nov 11, 2010
I am developing a small game in flash and decided to use AS3 for it! Now the problem that has happened to me is that the condition within an if statement is executed!!!
Here is my code:
ActionScript Code:
if (y > 850 && splodeCount == 0)
{
play('Sploding');
splodeCount++;
}
Now instead of trying if the conditions (y > 850 && splodeCount == 0) are true it simply follows them as if they were orders. For example it places the object at y 850 and makes the splodeCount 0!
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
May 26, 2011
I am trying to get my pages through Case Statement But.
[Code]...
View 6 Replies
Dec 17, 2008
I'm trying to use the value from a combo box in a switch case statement but it isn't working
Code:
var switchValue:int = 0;
switchValue = int(cmbColour.selectedItem.data);
switch(switchValue) {[code]....
View 4 Replies
Feb 20, 2009
I've got a slider on my navigation bar that rides along with the mouse; movies play perpendicular to it as I scroll. If I click on the movie, I link out to another page (easy enough). However, the actual slider doesn't do anything more than look nice. I know that if I don't make this thing child proof, I'm going to catch grief about it. So I tried to set up a switch that links out according to range values y<0 && y>125. As it stands, I don't get any errors, it just always goes to default. I'm missing something.I could always try a gia-normous 'if' statement, but I thought that I'd give the switch a try.
View 4 Replies
Nov 2, 2010
I see Switch statement in:
switch() {
case 'string': ...;
}
but would hope if I could do this?
View 1 Replies
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
Feb 18, 2004
How do you do a range using switch statement in ActionScriptFor example:
score = txtScore.text
switch(score)
{
[code].....
View 3 Replies
Feb 18, 2004
How do you do a range using switch statement in ActionScript For example:
[Code]...
View 3 Replies
Nov 27, 2002
Is there such thing as a "select case" statement in actionscript? If there is what is its format?
View 2 Replies
Jan 18, 2010
I have a large group of functions.The function to be called depends on the value of a var (which is a int);I could make a long case statement along the lines of this
PHP Code:
var Pos:int = 0;function test1():void{ trace("Test 1");}function test2():void{ trace("Test 2");}function test3():void{ trace("Test
[code]....
View 3 Replies
Dec 30, 2009
I am trying to figure out how to apply the is operand or the instanceof in a case statement to determine which datatype a interface object belongs too. keep getting errors
switch (IOjbect is)
{
case Tile:
[code].....
View 2 Replies
Sep 22, 2010
I've been creating an application using the Adobe AIR Packager for iPhone (command line style).The app consists of a lot of screens that provide various information, and the navigation is handled all in the document class via an event-triggered function that uses a large switch-case statement to determine what screen to go to.
When we compiled it through the iPhone Packager and tried to test it on one of our phones, it would load up to a blank screen.
After some error testing it was revealed that the switch-case itself is causing a problem (changing it to an if-else that had the same functionality worked just fine). Does anyone know whether this is a known issue, or if something can be done to fix that other than converting it to an if-else.
View 1 Replies
Jan 7, 2012
How i write the inline conditional statement in Flex with two expressions(case) [code]...
Flex compiler only check the first expression and on behalf of that give result.But i want to check both statement and show result.
View 4 Replies
Jun 6, 2011
I have some trouble with the conversion applied by BlazeDS to the name of the properties when this name begins with a lower-case letter followed by a capital letter. I have an ActionScript class similar to this:
[Code]...
View 1 Replies
Aug 24, 2009
I work on AS3 one week, and then take a break for a few weeks, then work on it a day, take a break, etc.. So I forget some of the basics, and need refreshers. I think I need to stop taking breaks.
Problem: I push multiple strings into an array, and some of the strings are the same.
Code:
var myArray = new Array();
myArray.push (Snivvle);
myArray.push (Kirupa);
myArray.push (Snivvle);
I want to find out which element positions "Snivvle" hogs up. We can see that it would be using element 0 and 2, and if we do an "indexOf" we would only get to see element 0, and doing a "lastIndexOf" we would only see element 2. How do I find out ALL of the element positions "Snivvle" is located in, so that it returns: element 0, element 2.
View 2 Replies
Sep 12, 2009
I have a BD return by PHP without problem : I have "all_good" and "no_good" If the variable change my condition don't change ..... why
[Code]....
View 3 Replies
Nov 24, 2007
How do I concatenate variable names in AS3?Something like this:
for(var i:int=0 ; i<5 ; i++) {
var "myVar"+i:Array = new Array();
}
View 5 Replies
Nov 25, 2008
When I use the code below the "!" never appears in the output text field. I tried removing nameInput.text and then the "!" will appear. But with nameInput.text in the code, any string I try to add after it does not appear.
View 3 Replies
May 27, 2009
How can I prevent concatenating when using the addition operator? totalCost_txt.text = (firstCost_txt.text + secondCost_txt.text)I can replace the "+" with any other operator and it works. (huh?)
View 3 Replies
Apr 6, 2011
I'm trying to make a function which ideally you tell it to go to the next level and it sorts everything out to transition to the next level for you. Currently I use this to get from level 1 to 2...
[Code]....
Also I need to make it so it checks if levelText == whatever on press of the Enter key, as well as the mouse click on GoButton.
View 2 Replies
Dec 23, 2009
I'm starting out with AS3 and migrating some old code. I have several dynamic variables in AS2 but they are using _root which isnt available in AS3.How would I go about switching the following variable to AS3? I have at least a dozen different variables similar to this one.
Code:
for (i = 0; i < (k-1); i++) {
pivot = _root["AI"+i][i][i]; // existing AS2 code
[code]......
View 3 Replies
May 26, 2010
I have this code to push "Variable1" in to MyArray:
ActionScript Code:
_root.MyArray.push(Variable1);
Note:
"Variable1" is a number stored as a string.
When "Variable1" changes, the code above is called upon to add the new "Variable1" value in to MyArray. Then I have this code which is called upon to find the sum of all the values within "MyArray":
ActionScript Code:
for (i=0; i<=_root.MyArray.length-1; i++) {
_root.MyArray_Total = _root.MyArray_Total + MyArray[i];
}
My problem is that rather than adding the values contained within MyArray (as if they were numbers), the values are being concatenated instead.
Example:
If MyArray values were 1, 2, 3
I want the MyArray_Total to = 5
But instead... MyArray_Total = 123
I tried making a new variable named "Variable1_num", declaring it as a number, making it equal to "Variable1", and then pushing "Variable1_num" in to "MyArray"... but that didnt seem to work either.
View 1 Replies
Nov 20, 2007
I'm trying to concatenate a name and variable number. Then trace it, so answer3 should output from my loaded xml data "water". Instead all I can get to trace is the word "answer3". If I type "answer3" in the trace I get the variable im looking for. If I type [this.getCorrectAnswerNumber()] in the trace I get number 3. How do I go about concatinating the word answer and a dynamic number.
Heres my code...
Code:
trace("answer"+[this.getCorrectAnswerNumber()]);
View 7 Replies
Oct 30, 2011
What I'm trying to do is create a program that, depending on 2 variables, multiplies another variable by a static number. Heres the code I have so far:
[Code]...
View 1 Replies