ActionScript 2.0 :: 'if' And 'else' Statements Executing At The Same Time?
Mar 25, 2011
I have this code on an onPress event. Just wondering why it's executing my if and else statement at the same time? I've never had that happen before.
ActionScript Code:
if(cableNum + connectNum == 2)
{
[code]......
View 3 Replies
Similar Posts:
Sep 22, 2009
how could I find out how long is some function executing?is this number, however small, always consistent for the same function or there may be differences (taking in consideration that only one function is running at each moment)?
View 1 Replies
Oct 12, 2010
I have no problem getting the current minute using the .getMinutes command, but I would like to use that number in an if statement:
ActionScript Code:
if(minute>=30)
doSomething();
else
doSomethingElse
View 4 Replies
Jan 16, 2010
i'm trying to make a craps game in flash.The program starts with a login screen which takes you to a menu, then you get the choice of 3 games. I'm on my second game so far which i'm having trouble with.So far i've managed to get 2 spinners with numbers 1-6 on each, which will spin, give you the values in 2 separate text boxes then add the value together in another text box.The trouble i am having is the winning and lossing condions, where i have no idea where to start.
Rulse are if your value equals 7 or 11 you win
if your value equals 2,3 or 12, yoo lose and
if your value is anothing else then user gets another go and has to get the same value again or get a 7 and lose.
Heres code so far:
import fl.transitions.Tween;
import fl.transitions.TweenEvent;[code]....
i need to create another function or create if statements within existing functions.I tried creating another function afte the bottom function but got a lot of time constant errors and unexpected else statements whihc i didn't understand.
View 2 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
Mar 31, 2011
I was wandering if it is possible to execute an .exe file with a flash swf. when you click a button?I would like to use it with the button symbol.
View 9 Replies
Nov 10, 2002
I'm using the loadmovie action on a frame that is played several times when certain buttons are clicked and the problem is that everytime the frame is played it would load the new movie again. Is there a way to disable the loadmovie action after it is executed the first time? I only need it to play once and thats it.
View 4 Replies
Feb 3, 2010
So I've got a flv embedded on my stage and I want to call a function (a getURL) after it finishes playing
View 2 Replies
Feb 26, 2012
Is there any way to execute some actionscript in a child swf from the parent without actually having the script in the child swf,or having to add a callback.I'm new to flash so i don't know what can be done,or if it's easy to do.to be more specific,i need search a array.
View 6 Replies
Jun 18, 2010
I've setup a very simple FLA, if you wanna see what I'm talking about:[URL]..If you fire the swf and you click the red thing (button), you will go to frame 2. If you click it again, you will go to frame 1.
Both frames contain a green mc with a "this.visible=false" action, so you shouldn't see it the first time.
Now click fast the red button. You will see the green mc from time to time.So, seems the flash movie is executing "clicks" every ENTER_FRAME (not immediately when you click the button). The sample mc I attach has a framerate of 1fps, so you can see easily the behaviour, but it's the same with 30fps.
And the same for the green mc. The "this.visible=false" line is not executing immediately when the main timeline reaches the related frame.
In the second frame, the green mc is contained inside a red mc. If you break appart this red mc, all will work as it should and you will never see the green mc (the FLA file is attached as well, so you can test).
So, my main goal is that I can never see the green mc, being it or not child of other mcs.
View 4 Replies
Dec 14, 2010
I have created a as3 log in script in flash cs5 that sends the username text and password text into two php variables. now everything works fine if i call navigateToURL (PhpURL,"_ blank");it returns with success , but the problem is that when i try to get to trace the output of the php file , it returns with a failure(even though i also call the above code at the same time and that returns success in my web browser). could it be a problem with cs5 , how would i go about viewing the trace() after i published it and put it on my local web sever.[code]
View 3 Replies
Jan 12, 2010
is it possible to stop a web service from executing?
I have a flex web application that searches clients with both full name and client id, when searching by name sometimes the usuer just types the last name and it takes a long time.
Since the app is used when clients are waiting in line, I would like to be able to stop the search and use their full name or id instead, and avoid waiting for the results and then having to search the user manually within the results.
I meant "web service" I actually meant mx.rpc.soap.mxml.WebService, I want to stop it from waiting for the result event and the fault event.
View 2 Replies
Feb 27, 2011
I am beginner in FLEX programming , I am trying to implement a very simple LOGIN system using PHP, FLEX, MySQL.
protected function button2_clickHandler(event:MouseEvent):void
{
var create_new_user:Users= new Users();[code]..........
I have added the "alert.show" to check the sequence , it was really strange to find out the it is executing "6,5,4,3,2,1"..?? Which mean user is created before checking the verification result?
View 1 Replies
Oct 12, 2011
I have a set of ~5 ActionScript 3 classes that are currently used within a flex 4 application. Although their output is used to display graphs etc in my flex app, the classes themselves have no visual components - they are only used to do complex math computations (I originally implemented them in AS3 in order to avoid constant server calls when computations were needed by the flex app).
However, I now want to make the same mathematical computation engine available on my linux server so the computations can be done within PHP. Is there any way at all to access the logic in these classes on the server? I would really like to avoid re-implementing the complex logic in PHP.
View 2 Replies
Feb 13, 2012
I'm a total noob using the Facebook Graph API for AS3. I have a Flash game and the idea is to upload it to Facebook, and everything seems to be ok (When entering the Facebook app, the swf shows perfectly and I'm able to post the facebook user id, the user name and the score to a database in the server where the game is located. I intend the game to automatically post to the user feed what he/she had score, but after making a lot of tests I found out that the method is simply not running.[code]
View 1 Replies
May 6, 2010
Here's a damn useful snippet:
ActionScript Code:
/**
* Use in place of trace(). Calling function will be logged automatically.
* */
[Code]....
Put that code in a utility class, and then from any function or method in your app, call myClass.reportStatus("Something happened"); and you will be rewarded with something like this:
060510 15:48:11com.foo.commands:oSomethingCommand/execute()Something happened
View 3 Replies
Jun 16, 2010
I've setup a very simple FLA, if you wanna see what I'm talking about:ample.zipIf you fire the swf and you click the red thing (button), you will go to frame 2. If you click it again, you will go to frame 1.Both frames contain a green mc with a "this.visible=false" action, so you shouldn't see it the first time.Now click fast the red button. You will see the green mc from time to time.So, seems the flash movie is executing "clicks" every ENTER_FRAME (not immediately when you click the button). The sample mc I attach has a framerate of 1fps, so you can see easily the behaviour, but it's the same with 30fps.
And the same for the green mc. The "this.visible=false" line is not executing immediately when the main timeline reaches the related frame.In the second frame, the green mc is contained inside a red mc. If you break appart this red mc, all will work as it should and you will never see the green mc (the FLA file is attached as well, so you can test).
View 0 Replies
Dec 8, 2004
I have a function and a movieclip prototype. When the prototype applies an onEnterFrame to an mc, it repeatedly calls the function (hitTests for all other mcs). Besides this, it also eases the mc to a new point. However, when the mc have reached this point, the function handling the hitTests stops being called
PHP Code:
//Prototype....MovieClip.prototype.moveSprite function(speed, spriteType) // Generate random coordinates var tarX = Math.round(Math.random()*(400-
[code]....
View 5 Replies
Mar 19, 2006
I've done some searching around and was wondering if this works. Is it possible to send a function command to a SWF from an HTML page? Basically, a javascript based menu that executes a function in a swf contained on that page.
View 2 Replies
Jul 17, 2003
A function has to "run"(execute) inside the onEnterFrame event method but the function does not seem to run when called.
Example:
_root.onEnterFrame()=function(){
if(something==true){
performFunction();
[Code]....
View 3 Replies
May 12, 2008
I have an RFID reader scanning tags. The first IF statement works flawlessly with my counter to detect if it should log the item in or out. The 2nd and 3rd don't work at all. I've tried 3 IFs, I've tried 1 IF and 2 ELSE IFs, 1 IF, 1 ELSE IF, 1 ELSE...nothing works. This project is due tomorrow and no one else at school has figured it out yet
stop();
/**SERIAL SERVER**
/**java -jar ss6.jar at the command prompt**/
[code]....
View 2 Replies
Jun 17, 2009
I have some action on a timeline, on frame 10 (a keyframe). So currently I'm on frame 1, and when I gotoAndPlay frame 10 , the code gets executed.
BUT, when I'm on frame 1, and I gotoandPlay frame 11 , the code does NOT get executed!! It was a shock actually, cuz I never thought flash would behave this way. Or is this something new with Flash/AS3?
If Im jumping to any frame after 10, how can I let that code be executed? Note that im just giving a numbered example, but in reality, I dont know which keyframe has some code.
View 5 Replies
Sep 7, 2003
I have two large doors slamming shut and would like to execute the browser shake javascript function hardcoded into the html page for about 0.1 - 0.2 seconds.. just enough to shake the window when the doors slam shut.
How do I call the shake() function that is on the same html document as the swf object? Not from a button press, but from an event (ie certain keyframe reached).
View 4 Replies
Aug 18, 2004
I have a problem with executing a method called handleXML. At the moment I have the following code:[code]That means that for some reason the calling the handleXML method failed. Does someone know what is wrong with my code?
View 9 Replies
Dec 8, 2004
I have a function and a movieclip prototype. When the prototype applies an onEnterFrame to an mc, it repeatedly calls the function (hitTests for all other mcs). Besides this, it also eases the mc to a new point. However, when the mc have reached this point, the function handling the hitTests stops being called.
PHP Code:
// Prototype....MovieClip.prototype.moveSprite = function(speed, spriteType) { // Generate random coordinates var tarX = Math.round(Math.random()*(400-this._width/2)+this._width/2); var tarY = Math.round(Math.random()*(300-this._width
[code]....
The function should trace "carn" over and over and over, but instead, it traces "carn" over and over until the prototype picks a new point to ease to.
View 5 Replies
Sep 29, 2009
how i should be executing external functions from a .swf loader...here's my loader function:
Code:
on (keyPress "e") {
_root.createEmptyMovieClip("container", 1);[code].......
i can easily load the swf into the frame, but the colors don't change. Playing coloreffects.swf on its own works fine, just not through the loader. I imagine this is because you can't just operate two levels of AS2 at once...
View 7 Replies
Nov 24, 2009
I'm trying to execute a fucntion by calling it through an event listener I can't call it directly seems to be out of scope or un intialized or something. I've had luck calling variables in this manner but have never tried to call a function. Can I do it through the event?
PHP Code:
e.currentTarget.parent.timer.timekeeper.stopTicking();
View 3 Replies
Aug 6, 2008
Iam trying to execute a SWF file which has its actionscriptwritten in AS3. When i execute this, I am getting an error messagewhich is as followsVerify Error 1030# Stack Depth unbalanced 1 != 0..
View 4 Replies
Jul 30, 2009
I'm having no success getting a timer to work, let alone one that executes a function every X seconds (say every 10 seconds).
[Code]....
View 1 Replies
Jan 12, 2011
I have a dynamic tween within a function, which basically makes a movie clip visible,after it had been made invisible by another tween call.Code to make clip invisible:
function imgopen(){
var fholderDark:Tween = new Tween(this.mc_load1360.folioholdermc, "_alpha", Regular.easeOut, 100, 0, 1, true);
[code].....
View 5 Replies