ActionScript 3.0 :: Nest Switch Statements Over Each Other?
Feb 1, 2009
I have been seriously investigating on using switch statements in this case to solve my problems, which I seem to see output showing up in clickHandler3 executed properly. However, I don't think scenario_save() has been doing anything, since I could not see the Alert.show statement been disclosed in the switch(pop2), and neither is any of the lines been written like I expected, but I do see the Alert.show in the switch(x) by executing the Alert. I have marked the sections using comments, and I wonder if I am allowed to use nested switch statements over another in Actionscript.
[Code]...
View 4 Replies
Similar Posts:
Dec 27, 2009
I have a if statement that first checks to see if the enter key is pressed. Although i cant figure out how to to nest futher statements with in that initial statement. At the moment I'm checking for an enter keypress like so:if (Key.isDown(Key.ENTER))I suppose immediately after i want the script to see if a a textboxes variable is empty or not.IF its empty run x code.IF it has content run y code.Seems straight forward enough but i cant seem to figure out how to nest them under the first Enter key IF check.
View 3 Replies
Mar 10, 2009
In this example, is there anyway to fade in and out 'mcContactAmer' and 'mcY' as well as place them at specific coordinates, other than externally load them as swfs? This is the only thing holding me back from moving forward on this project and my boss would like to move forward,
View 3 Replies
Mar 10, 2009
In this example, is there anyway to fade in and out 'mcContactAmer' and 'mcY' as well as place them at specific coordinates, other than externally load them as swfs? This is the only thing holding me back from moving forward on this project and my boss would like to move forward,This is what my code looks like:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.geom.Point;
[code].....
View 1 Replies
Oct 2, 2009
I have 3 input text boxes and I want to display a different part of an XML file to display (in a different textbox) depending on what input textbox has been selected.
I have achieved this by using 3 separate functions and it works fine but I want to use a switch statement within one function to achieve the same result. So the user will click on a textbox which calls the function and switches depending on the textbox to load the text from an XML file.
I don't know if using a switch statment in this way is even possible to do.
Code looks like this:
var req:URLRequest = new URLRequest("Manual.xml");
var loader:URLLoader = new URLLoader();
var manual:XML;
[Code].....
View 3 Replies
May 22, 2007
the flash autoformat destroys my code... And i use it all the time .. my switch and for statements doesnt work anymore after autoformat, it adds ';' where it shouldnt..
View 14 Replies
Aug 28, 2008
If the subject isn't entirely clear, it's because I'm not sure how to describe what I want to do. What I have currently is a large group of ComboBox components which trigger an event handler, which uses a Switch...Case statement to determine the selection, and then uses another Switch...Case to figure out which ComboBox actually called it so the function called can use the appropriate arguments. The way I have it written has bloated the code, so I'm wondering if there's a shorter way to do this.
[Code]...
View 1 Replies
Jul 9, 2009
was wondering if there was any way to implement the "||" operator for switch statements.. in the case of an "if" statement, this is how it would be:
[Code]..
View 2 Replies
May 12, 2010
I'm trying to setup my bin-debug folder so that the structure looks like this[code]...
I've tried setting the project's output folder to: bin-debug/assets/swf which does get my main.swf where I want it, but then my other source folders get dumped into that swf folder as well. What I would really like is to tell Flash Builder to put my swf into a nested folder and to be able to specify where my build folders' output goes as well. Is this at all possible without resorting to ANT scripts?
View 3 Replies
May 25, 2005
I'm just trying to nest buttons one on each of two frames inside a mc. I've tried everything. Here's basically the script I used.
[Code]...
I've tried adding _root infront of screen name and even tried just having the button go to the second frame in the same scene. I'm just trying to get this first button to work and then I will add the other button.
View 3 Replies
May 6, 2010
I have a MC with an instance name MovieClip_1 and I create another like this:[code]So basically, what I want to know is how to nest MovieClips using code, display them, and change their positions reletive to their parent MovieClip, and not the root/stage.
View 1 Replies
Oct 7, 2004
If they get a question wrong in my quiz ( weakest link) the money clip goes to zero and it goes onto the next question. If they get it right the money clip advances and they go onto the next question. I want to include each time that it should only go onto the next question if all questions have been asked. SO i want an extra if clause in both sections, saying if current question is more than 11 go to '#game over"The questions are saved in the frame of the quiz
_root.qArray = new Array("question: A;B;C;D")
_root.qArray.push("Question?:A;B; C; D")
There are 11 questions.At the moment at the section with choosing answers I have
function selectAnswer(n) {
// correct
if (answers[n] == correctAnswer) {
_root.money.nextFrame();
[code].....
View 1 Replies
Sep 15, 2010
Is it bad practice/design to nest components inside components using Flex 4? Should I simply be creating components and inserting them into my main application as below, or doesn't it matter?
<com:MyComp1>
<com:MyComp2>
<com:MyComp3>
[code]....
View 1 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
Dec 10, 2003
I want this on an MC:
[AS]
i = 0;
switch(thing){
case 0:
[code]....
Basically what I'm wondering is, will I lose the value of i in the first switch once I'm out of the switch? Can the second switch read the 1st switch?
View 8 Replies
Oct 29, 2011
Im trying to create a program that, depending on 2 variables, multiplies another variable by a static number. A friend suggested I use case/switch instead of if/else statements,which is what I was using before.
[Code]...
View 1 Replies
Apr 15, 2009
I am trying to use if and else statements and failing. I am either completely missing their purpose, or just not writing the correct code. Scenario: I have designed a gallery that consists of animation in movie clips that are placed on the time line. With the if/else statements I need Flash to know what movie clip the user is on, so that the users next action loads the correct movie clip.
[Code]...
View 4 Replies
Apr 18, 2009
Is it possible to double up If Else statements? [code]...
View 2 Replies
Sep 14, 2009
how do i create an if statement for some buttons to say something like:
-if button1 is pressed go to frame1
-if button2 is pressed go to frame2 etc.
i know i could use button1.onRelease = function(){blah blah;} but i would like to start using if statements and this is a good place to start i guess
View 1 Replies
Dec 3, 2006
I want to join two if statements together and I'm unsure of the syntax. This is what I have but it is obviously wrong. if (Key.isDown(Key.RIGHT) or if (moveRight_btn.onPress){
View 7 Replies
Oct 6, 2009
How to do a rollover button where you rollout and it doesn't another option depending on the current frame. So I decided to open up another actionscript file and do a test so that I knew that I could make an if statement work in a barebone state. And I can't get it to work
First I stated my variable to be 0. I added 3 buttons. Button One makes the variable unit "myVar" to 1 and Button Two makes it 2. And my output button reacts to these variable changes. But it doesn't work.
ActionScript Code:
One_btn.addEventListener(MouseEvent.CLICK, OneV);
Two_btn.addEventListener(MouseEvent.CLICK, TwoV);
Output_btn.addEventListener(MouseEvent.CLICK, OutputV);
var myVar:Number = 0;
function OneV (event:MouseEvent):void {
[Code] .....
View 4 Replies
Nov 20, 2009
well after I made all of the conditional statements I came to the conclussion and the annoyance that I cannot retrieve the statements value, I need help:[code]it does not return the value.. why?
View 5 Replies
Mar 3, 2011
I was wondering if anyone would be able to shorten this.All of my attemts at it have resulted in errors/not working.
ActionScript Code:
enemy1.onEnterFrame = function() {
if (this.hitTest(p1)) {
[code].....
View 1 Replies
Aug 25, 2009
After searching for how to do this i discovered the Get/Set functions of as.3. The only problem is that i am not experienced enough with this kind of statement to get it working, so i have come here to seek from the wise and masterful members Here is some more info:Inside a fla called "Main" i have 2 MovieClips. The first is called Main and has a class linking to the com/Main.as file which has this code:
Code:
package com{
import flash.display.MovieClip
[code]....
View 10 Replies
Apr 19, 2010
used to be able to handle variables and if else statements back in AS2.0, but I don't know how to go around them in AS3.0For instance, a code like this:
stop();
var pageNum = 1;
var pageAnim = 1;
[code]....
View 7 Replies
Apr 12, 2012
i have got a project im working on that requires if statements
basically im wanting to create 2 or more statements detailling if an answer is right, to move onto the next question but before it does that, to play an audio clip then move on. the next statement will be similar, but i cannot remember how to create them i.e. the syntax.
if i could get a response ASAP that would be gr8, as i have 2 weeks to get it done.
View 3 Replies
Jan 28, 2009
I'm making a small movie in Actionscript 2, but have found a problem related to the scope of my functions.Figure I have an audio/mute movieclip, with a global variable called "elaudio" (boolean). When "elaudio" == true , the volume is up, when "elaudio" == false, the volume is muted.I'm attaching sounds from the timeline using Actionscript with an object sound, this way:
Code:
_root.audio.attachSound("myWav");
_root.audio.start();
[code].....
View 2 Replies
Apr 25, 2009
I'm trying to make a "next track" button. "T" is meant to be track number, and every time they click this button, I wanted "T" to increase by one until T>4 where I need it to go back to T=1 (I've only got 4 tracks). Then, I want, depending on what "T" equals, for it to start playing Track"T" and stop playing previous track. I also want the track playing to be looping continuously. At the moment, everything is muted, until I press the button; where it then plays all four tracks at once. I also have a problem with the mute button, but I've got a strong feeling both are of the same reason. I think my problem is that it does not know what "T" equals to begin with so it accepts all if statements; playing all tracks. But I'm new to Flash (my second project) so I'm not sure.
on (release){
stopAllSounds();
T =T+1
if (T>4){
T=1
} if (T = 1){
_root.snd1.start(0, 100);
[Code] .....
View 3 Replies
May 5, 2009
How do you script a Pause of X Seconds on X Frame and also on that frame have a button release statement that can take you forwards or take you backwards, elsewhere in the timeline - Without affecting the 'Pause' statement... therefore not mucking up the timeline and causing it to jump around at the end when all catches up?I take it once a pause has taken place - a button that can take you elsewhere, if clicked on - does not Cancel the initial pause and therefore lies my problem?
View 3 Replies
Sep 28, 2010
When use the full path name and the identifier of a movie clip, my conditional statement works fine. However, when I swap the identifier out with "this", it no longer works. This script is contained within the movie clip I am trying to reference. I have found that, "this" works fine by itself on the timeline. It just stops working when I place it within a conditional statement.
Here is my script:
function functionOne() {
randomX = 550*Math.random();
randomY = 400*Math.random();
} functionOneInterval = setInterval(functionOne, 1000);
function functionTwo() {
[Code] .....
The reason I am trying to use "this" instead of the identifier name is because the movie clip it is referencing will be duplicated. This script here generates a random destination point for an enemy spaceship and tells it to constantly move to the changing points. This script is contained within the enemy spaceship movieclip, and I am planning on duplicating several of them at once.
View 1 Replies