ActionScript 2.0 :: Can't Seem To Find A Pause/wait/delay Function?
Jul 6, 2005
I just want to have my code wait a couple seconds to let some scripted animation finish then load a movie into a holder but I can't seem to find a pause/wait/delay function is there one and how would I use it or can someone tell me how to do it somehow thats not too processor intense if at all possible.
View 6 Replies
Similar Posts:
Feb 3, 2009
Okay my_btn will do this;
image_loader1.loadMovie("imagepath");
gotoAndPlay(frame#);
What i want to do, is, make it wait before it the timeline goes to the certain frame#, so the image_loader1 loads its image1. I'm making it wait, not because it takes time loading (which it would not, since image1 is already on the stage, loaded up in image_loader2) but the image still takes time to show on the image_loader1 (half a second).So, I want my_btn to be functioned like this that it performs its first action which is
'image_loader1.loadMovie("imagepath");' and then 'gotoAndPlay(frame#);'..
View 3 Replies
Aug 24, 2004
I'm using this function
function wait(mc, n) {
mc.stop();
var myInterval = setInterval(function () {
mc.play();
clearInterval(myInterval);
}, 3 * 1000);
} _root.wait(this, n)
To delay events along my timeline. That code works fine. My problem is that is that I also want the user to be able to pause the movie at any time. However, if the pause button I'm using is pressed by the user while the timeline is delayed using this function it starts playing again after the interval even if the pause button is still pressed. How can I override this wait function with a pause button?
View 5 Replies
Jul 8, 2009
I'm writing a movie scene in AS3, and I hit a snag. I have a movie where the dialogue is advanced by the user pressing a button (the space bar). I have a speak function which prints out the dialogue to a dynamic text box. However, if I type in this:
speak(1, "Hello world!");
speak(2, "Hello back to you as well.");
Then, my first speak function is immediately overwritten by my second one...because they run at the same time. I'm not using the timeline so, I can't put a stop() function in or anything. I'm doing it all in ActionScript.
Is there a way to pause the movie and wait for the user to press the spacebar before loading up the second function. I was thinking of nesting functions to do it, but that seems overly complicated since I'll have nearly 20 lines of dialogue nested within one another in between moving my sprites around.
View 3 Replies
Oct 21, 2009
Im trying to make some sort of hearing check to see if your ears are still functioning the way they should be. In my program the user is shown 9 images (for example an image of a cat) The images correspond to the 1 - 9 keys. (Im not sure if this is relevant but i'm programming for a Flash Lite application to be run on a mobile device)So let's say the image of the cat is number 1. The sound of the cat is being played and the user has to press the 1 key on his keyboard. However for this to be possible the script must pause and give the user the oppertunity to press the correct key.How can i make sure the script does not continue until a key is pressed after playing a sound.Below is my code so far:
Code:
stop();
var pressedKey = new Number();
[code].....
View 1 Replies
Jan 23, 2009
I've tried to create the code to do the following,.. after you press the button the movie will slide to a certain point ( 100,100 ) and then the movie will start its motion again ( nMC.startMotion() ) the problem is it doesn't have time to move to the position before the movieclip startmotion code kicks in. So basically i need some kind of delay in the code! Is this possible? [code]...
View 3 Replies
May 31, 2010
Is there a good way to cause a pause or delay within the execution of a function?
I am making a board-type game (picture something like othello although the rules are different) which I have been building up piece by piece for some time now. One of the places I am having a problem is with something I never anticipated would have been a problem, and that is with creating pauses between when the computer or player makes a move and when the board data is updated and the board data is displayed. I want these delays for two reasons. First it will help with debugging because sometimes the moves happen so fast it is hard to tell what the computer did. Second it is needed because I want to add animation for pieces when they jump or divide and when they change enemy pieces to a different color. The animation will need to know what move was made but not allow the board visual to be updated until after the animation is complete.
I have tried using the timer but it gets really harry and it is problematic because you can not pass any variables to it besides the event that triggers it. If I try to use global variables to get around it, the code becomes messier and also I will have a problem when I want to make the function recursive. I could try to build global variables into an array but things would really be getting messy at that point. It seems unbelievable that the creation of a delay would be so difficult.
View 3 Replies
Mar 6, 2010
I have a button then when clicked plays a random movie clip on release. The problem is if people don't wait for the clip to finish and just keep clicking, more random movie clips overlap the first one. I'm trying to figure out a way to make it so clicking is does nothing until the clip is complete, or a set amount of time has passed since the clips are all the same length.
View 2 Replies
Jun 2, 2003
(Flash 5/Flash MX). How do I delay/pause using actionscript? I have tried using a for loop for a time delay like this:
for(i=0;i<1000000;i++){
}
But it does not work?
Flash gives an error like:
Time-consuming actionscript.
Abort running script?
OR the loop simply does not produce a noticeable delay.
How I can introduce a time-delay or a pause using actionscript?
View 12 Replies
Jan 23, 2009
I'm using this piece of code from a panning source file uploaded to this site while back. I've tried to change the code so that after you press the button the movie will slide to a certain point ( 100,100 ) and then the movie will start its motion again ( nMC.startMotion() ) the problem is it doesn't have time to move to the position before the movieclip startmotion code kicks in.
img.b3.onRelease = function() {
nMC.slideToPoint(100,100); I need a delay here; nMC.startMotion()
}
View 4 Replies
Nov 11, 2009
at the tail end of my Flash cs4, actionscript 3.0 college project and want to incorporate a countdown Timer Event when there is a 3 minute delay of usage in the flash movie (interactive).Below is what I understand and want to accomplish.Is it correct to place the actionscript code in the actions layer of the 1st frame within the 1st scene?And will it be recognized throughout all the scenes within the flash movie?1. Have the flash movie recognize a delay of usage (no clicking) after 3 minutes to start a countdown Timer Event.??Where would I add code to the timer to fire every 3 minutes during a delay of usage?
import flash.utils.Timer;
import flash.events.TimerEvent;
var count:Number = 11;
[code].....
View 1 Replies
Apr 17, 2009
Visual Studio had a command "showDialog()" which allowed you to show your form as a dialog box on the screen. The advantage to this was that the code calling the dialog box would pause, stopping execution entirely until the dialog box closed. The benefit was you could write your code as follows (made "actionscriptey"):
Code:
var result:DialogResult = form1.showDialog();
if (result == DialogResult.OK)
[code].....
View 1 Replies
May 31, 2010
is it possible to have a wait function inbetween the 2 actions here?
import fl.transitions.*;
import fl.transitions.easing.*;
TransitionManager.start(img1_mc, {type:Fade, direction:Transition.OUT, duration:9, easing:Strong.easeOut});
TransitionManager.start(img2_mc, {type:Fade, direction:Transition.OUT, duration:9, easing:Strong.easeOut});
View 5 Replies
Sep 28, 2009
i want to check a boolean value whenever pressed pause button in flv player.Any Event for play/pause button pressed like
_mc.addEventListener(MouseEvent.CLICK,pressed) ?
View 3 Replies
Aug 19, 2009
I have a actionscript file and it tells a function in another actionscript file to run.How can I add an event listener to wait for the function to complete in an external file.
View 9 Replies
Mar 26, 2009
is it possible to insert a delay before a function is executed.Here is a simple sample code where it could be used:
Code:
myButton.onRelease = function () {
//// INSERT A 3 seconds DELAY BEFORE THE gotoAndPlay is executed
[code].....
View 7 Replies
Feb 17, 2012
I'm just trying to make a simple function that will return all the data from my SQLITE database as an array. But it looks like when my function is returning the array, the SQL statement is actually still executing... so it's empty... Does anyone have a suggestion? Or am I just going about this whole thing wrong.I know I could just have the event listener functions outside this function, and they could then set the data. But i'm trying to make a AS3 Class that holds all my SQL functions, and It would be nice to have everything for this particular function just in one function, so it can return an array to me.
public function getFavsGamesArray():Array
{
getFavsArraySql.addEventListener(SQLEvent.RESULT, res);
[code].....
View 2 Replies
Aug 8, 2007
I'm trying to find a function that will repeat my Rotational tween function. I found the yoyo() function to be what i want to do but i don't want the tween to change the rotation to CCW while originally moving CW. Basically i want the animation to move CW at a steady rate continuously.
I'm using the following code at the moment, i'm not too sure if this is the most suitable code for this situation, maybe im off track.
From my thoughts, i assumed that i would need to put the stars function in a onEnterFrame to repeat the animation and change yoyo() to continueTo() function. or maybe some sort of if statement in the stars function?
ActionScript Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var stars:Tween = new Tween(ring, "_rotation", Regular.easeInOut, 0, 360, 4, true);
[Code]....
View 5 Replies
Aug 10, 2010
I am trying to alpha-tween some text, in a sequential order, something like movie titles, where text appear one after the other, by fading in, and fading out. This is my piece of code and what i am basically trying to do, is to run the first block of functions, after the other, so i can display the first movie clip, and the after it fades, display the second movie clip and so on.... The problem is that both movieclips fade in at the same time..I have tried to add a function after the constructor, that would look something like this:[code]
View 5 Replies
Dec 23, 2003
how do I put a delay in my function, i want it to attach the ball, then wait 10 milliseconds, then attach another, how would i go about doing this, heres my code:
function attach() {
for (i=0; i<40; i++) {
repeat = attachMovie("ball", "ball"+i, i);
repeat._x = ((i*3)+30);
[code]....
View 2 Replies
Dec 13, 2009
I need to use some sort of delay function and I don't know if there is one
like: sleep(milliseconds){
action
}
or something like that.
View 5 Replies
Nov 9, 2005
I'm not getting any takers over in the Flash 8 forum.I am using the snow method wonderfully created here on Kirupa and have a quick question. Currently, the movie just starts with a screen full of snow. I'd like to get it to start off screen and fall in. Basically setting an initial state for the ._y of 0. I also can't seem to get a delay working for the function.[code]
View 4 Replies
May 24, 2009
my code is as below, i want the "showSavingScores()" function to appear longer, because i want to show to the player their score is saving.... the problem i facing now is the "showSavingScore()" only appear less than 1 sec the player is unable to see the saving messaga?
Code:
urlLoader.addEventListener(Event.COMPLETE, finishedSavingScore);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, failedSavingScore);
urlLoader.load(urlRequest);
showSavingScore();
View 1 Replies
Oct 30, 2009
I have a file in which I use this stage resize function. However if I resize really fast (like maximize button) it doesn't resize the Timeline.
Code:
stage.addEventListener(Event.RESIZE,resizeStage);
private function resizeStage(e:Event):void{
resetVideo();
_controlbar.resetControlBar(stage.stageWidth);
_barlength = _clickbar.width;
_levelstart = _level.x;
[Code] .....
View 2 Replies
Jun 25, 2010
I have a number of cases where I have a tween happening in ActionScript, but I would like it to happen after a delay from the event that triggers it. At the moment I'm creating this delay by having a tween that does nothing (eg. an "_x" tween for which the start and end points are the same) and then using tween1.onMotionFinished = function(){to create the one I really want. Is there a way to create this delay more neatly?
View 1 Replies
Feb 2, 2010
I'll try express this as easily as I can: I have an input text box (call the instance whatever you want). What it does is when you type a word, it makes another movie clip (let's say the instance is MORPH) go to a certain frame. The code is simple, but I'll give it to you to give you a better idea:
[Code].....
check is just a light that turns green if the word is complete, so ignore that. Whenever the MORPH object goes to, say "Earth", it plays an animation and afterwards, it hit's a gotoAndStop(1); code, stopping it at the first frame. What the problem is, say, you type earth, it goes to the EARTH animation, but before the animation finishes and goes back, you type EARTH again and it skips straight to the start of the animation. It looks very rough and bad.
What I want is, say I type Earth and the animation plays, and before it finishes the animation, and I type EARTH again, it waits until morph get's back to frame 1. So yeah, to delay a function until a certain frame is reached. Oh, and another thing. Is there a way to make a button click with AS2? Pretty much when it makes contact with another object, it... clicks (whatever it does to reach the DOWN frame and stay there until the other object moves off).
View 9 Replies
Aug 31, 2009
I'm trying to put a delay or timer inside of a function, ie:
Code: Select all
this_btn.addEventListener(MouseEvent.CLICK, doThis);
function doThis(event:MouseEvent):void
{
[Code]....
So that where I have the function for the button make that movie clip go to frame 1, it would wait one second before going to frame 1.
View 2 Replies
Mar 20, 2007
A couple weeks ago, I was searching for a delay function that I could put on a frame and it would hold at that frame for a given period of time.I came close to finding it, but what I found used setInterval and I wasn't able to stop it from looping.Here is something that I am quickly starting to love, it's not mine, but I don't know who's it is, it was on a piece I was working on at work (although this edition of it is partly mine, as I have adapted it to my specific needs).first frame
Code:
//wait function
function wait(a) {
[code].....
View 2 Replies
Apr 15, 2011
I am trying to add a delay function to a btn action in actionscript AS2. I want to delay the gotoAndStop function.I want the attachMovie("glamour", "glamour2", 202); to play in full before the gotoandstop action say for about 3 secondsI want to be able to delay for as long or short as needed?below is the snippet of code for the btn im working with?
Code:
timer=0
btn.onRelease = Delegate.create(this,buttonHandler);
[code]......
View 1 Replies
Mar 16, 2010
I'm trying to make a timer..
When I press a button a movieclip does this: gotoAndStop(2);
I want it to go back to Keyframe 1 after 10 seconds.
How can I get this to work?
View 6 Replies