Double Up If Else Statements?
Apr 18, 2009Is it possible to double up If Else statements? [code]...
View 2 RepliesIs it possible to double up If Else statements? [code]...
View 2 RepliesIf 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].....
I've got a bug in my code, where a button has to be double clicked to work.Just wondering what is the standard distinction for the difference between single and double click.
my code
ActionScript Code:
ns.seek(0);
subtitles._visible = true;[code].....
the idea is that it runs a function only when the above button is pressed, but it doesn't seem to work the first time you press the button ?
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]...
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
I have CS5 but just upgraded to cs5.5 yesterday...but why are my swf files in Flash cs5.5 more than doubling in size compared to using cs5?
View 1 RepliesI 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 RepliesHow 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] .....
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 RepliesI 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].....
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]....
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]....
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.
I am no longer able to doubleclick SWFs on my PC and have them open up in their own little SWF preview window. It is asking me to choose how I want to open them. There was no option for any Flash player, so I have had to settle for Firefox fo now which is annoying as it has changed all my SWF icons to the FF logo.I have Flash CS3 installed, and use Flash regularly to create banners and things, so this is a pain.
View 2 RepliesUse Double Datatype in flex?
View 2 RepliesI'm tasked with updating a Flex project created by an outside contractor and in the Actionscript is the following chunk:
CONFIG::FLASH_10_1
{
//Some code here
}
I've never seen this type of structure before and I'm having a heck of a time trying to search for it on Google - I've found what it means in just about every programming language except AS3.
I never really dealt with double click in flash, but I've been always thinking it's just the same as any mouse event handling. Here is the simple test code I've made:
ActionScript Code:
package
{
import flash.display.Sprite;
import flash.events.Event;
[Code]...
I'm really sick of clicking that red circle, but I got no event firing at all. I've changed windows double-click settings, have made another testing mouse listeners (all of them are firing) and all the things...
I have a MC in my project that acts as a popup window only it is really just a movie clip. One that loads hi-res pictures AND... here's the important part....has a startDrag() action attached to it so that the user can move the picture aside if they so desire.However to close this window, I'd like to have the user DOUBLE CLICK with the mouse. They should be able to double click anywhere on the movie clip or even anywhere else... it doesnt matter really. The thing is, how do I listen for a double click in ActionScript??
View 6 RepliesI'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].....
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] .....
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 RepliesWhen 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.
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 RepliesThis time I am trying to use button functions with in IF statements. However I am having trouble with the if statements regonizing the currentFrame(); or currentFrameLabel();. I want diffrent button functions depending on what frame the playhead is in. But the frames are in diffrent movieclips and what not.The next problem is that I do not full understand the way to do frame paths (IE Root.Movieclip.Movieclip) in AS3. series of tutorials that I could read and follow,
View 12 RepliesI'm working with 2 global variables and I need to compare them on 6 different button function clicks for a lot of different scenarios.[code]My function is starting to look like this;[code]only problem i see is that there are many different scenarios and this if statement could get very long. Is there a way to combine it somehow so there wouldn't be that many else if's?
View 3 RepliesI want to write AS3 code that has 2 variables; one that acts on odd numbers and the other that acts on even numbers entered into a text field ?(sorry I'm not making much sense here! Will explain the context further)I'd like to use an XML calendar in my Flash project that shows the odd or even dates in the calendar depending on what number you enter in a field being either an odd or even number. (This is based on ACT Water Restrictions odd and even watering restrictions)It means that if your street number is an odd number you can use water as per restrictions when the date also is an odd number. Similarly, if your street number is an even number you can water as per restrictions when the date also is an even number. You're probably familiar with this system.
The context is for my Adult Migrant students to understand the concept of our water restrictions here which is governed by this odd and even system.So what I'm doing to do next is buy a cheap XML calendar online which I can adapt for my project but I'm not sure whether I should be approching this code problem with an if/else statement to get the results or something else?how to write the code!!
if my number I enter is an even number then display (in an XML calendar) even days
else
if my number I enter is odd then display (tin an XML calendar) odd days
So I am creating a drag and drop game but the thing is that there is not one question for each statement. Is it possible to have say... 10 statments on the right and one "box" on the left where the statements can be dragged to, if its correct it stays there, if its incorrect it goes back to its original position.
View 12 RepliesI am interested in have a dynamic text field display three quotes at different intervals. I thought I could use the Timer to trigger these quotes by loading them into the dynamic TextField.
However, I cannot seem to get it going. I try to attach a number from the timer but that throws an error /1176: Comparison between a value with static type flash.utils:Timer and a possibly unrelated type int.
[Code]...
if(bookmark == "Q3") movieHolder.loadMovie("Q_3.swf");}else if if(bookmark == "Q4"){
movieHolder.loadMovie("Q_4.swf");
}else if if(bookmark == "Q5"){
[code].....
In a change of statements, i have if, else if, and else. Can I add a fourth condition? if so how?
View 2 Replies