Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Delay Before Playing An Action


It may be super simple but it's 4 am and I'm almost asleep . What I need is an actionscript code that will delay another action from happening x seconds.

For example:

I want to load a movie clip let's call it load1_mc and then after load1_mc loads I input a delay command that will wait x seconds before loading load2_mc and so on.

onEnterFrame

_parent.load1_mc.loadMovie("test.swf");

*Delay Function/Command Here*

_parent.load2_mc.loadMovie("test2.swf");

-----------------------------------------------------------------------

I'm almost sure there must be a simple way of doing it, but I just can't think of one now. Maybe the setInterval() instruction... I dunno. The idea is for loading mc's like the example above or any other "actions" I can think off without relying on frames.

Any help will be appreciated.




FlashKit > Flash Help > Flash ActionScript
Posted on: 01-24-2007, 03:28 AM


View Complete Forum Thread with Replies

Sponsored Links:

How To Delay Playing?
I'm trying have a MC fade in (MC name is i001 in the example below and is placed directly on the stage) upon entering the frame (this part of my AS works) and then wait a little (up to 150 frames in the instance below) before moving to the next frame of the _root.

My guess is that the line with gotoAndPlay(_currentframe+1) is the one with the error. I tried replacing this with just play() but that doesn't work either.


ActionScript Code:
onClipEvent(load) {
    fadein = 0;
}
onClipEvent(enterFrame) {
                _root.i001._alpha = fadein;
    fadein += _root.fadeinstep;
    timer += 1;
    if (timer >= 150) {
        gotoAndPlay(_currentframe +1);
    }
}


My "action" layer frame contains the stop(); command.

Anybody can help me?

Thanks in advance,

JR G.

View Replies !    View Related
How To Delay Sound From Playing?
Code:
var tl:TheLoop = new TheLoop();
tl.play(2, 1000);
When I have this in the first frame, as soon as I test the movie the sound plays. How do I make it pause for 2 seconds before playing? I thought this would work but it still plays immediately.

View Replies !    View Related
One-frame Playing Of 3 Movieclips - With A Delay Between Each One
I have 3 movieclips in the first frame, but the movieclips each have their own layer..

See attached movie.

Please - I want a code to play the first movieclip and then 4 seconds pause - then play the second movieclip and 4 seconds pause - and when the third movieclip ends it should go to first movieclip and start all over again.

I want it all to be in one frame because I had trouble with getting it to work properly over 3 frames.

See attached movie. If anybody could write the code in to the movie it would be nice. I have struggled with this for a long time.

View Replies !    View Related
How To Start Playing Many Clips With A Different Delay For Each One?
Hi,
I have, let's say, 50 occurences of the same movieClip (a ball changing color) and I want to play them all with one click BUT not at the same time, so I need to put a different delay on each clip.
I use the following code to catch all my movieClip but then don't know how to play them with delay...


Code:
for (x in atomMain_mc){
var myMcs:Object = atomMain_mc[x];
if (typeof(myMcs) == "movieclip"){
myMcs.play();
}
thanks for helping....

View Replies !    View Related
Unwanted Delay When Playing A Movieclip
I have a swf that loads a movieclip which basically just plays a sound. The movieclip is set to play the sound, then gotoAndStop on the start frame for the sound. This is so it will be ready to replay the sound should the need arise.

I have a repeat button in the main swf that the user can click to play the sound from the movieclip again. The code in this button is simply _root.movieclip.play();

This works fine except that there is a 4-5 second delay from when you hit the button and the sound actually starts to play. Does anyone have any idea what could be causing this delay? I've been searching my code all night and can't find anything that could be wrong...it is just a simple play command. I've tried changing it to gotoAndPlay with the appropriate frame number but it still has the long delay.

Any ideas?

View Replies !    View Related
How Can I Delay A Movie Clip From Playing 5 Seconds
I am new to flash and am having a little bit of trouble. I have 3 movie clips i would like to start 5 seconds after the last movie clip started. I would like movie clip 1 to start instantly the 2nd movie clip to start 5 seconds later and the 3rd movie clip to start 10 second later. Any help is much appreciated.

View Replies !    View Related
Flash 8 Video, Adding 10 Second Delay Before Playing?
Hi, I followed a tutorial and created a flash video player for my reel. I want it to say preloading or buffering for 5 seconds before the video starts playing. Can someone tell me how I would go about coding this? Here is the reel:
http://motioncrush.com/reel/reel2.html

Thanks

View Replies !    View Related
Delay On Playing Sound In Actionscript 3 Problem
good day,

My problem is that everytime an object (obj1) hits another object (obj2) a sound will play instantly as the object collides, but the sound will played with a delay of .5sec .

Does anybody know how to make this play instantly?


- newbie here - ^_^


Thanks

View Replies !    View Related
Delay Movieclip From Playing On Button Click
Hello

I'm sure there is an easy answer to this question, but for the life of me I can't figure it out.

I have a button in flash that onRelease causes one "animation to play" and "another to stop"

I also want this same button to call another movieclip but I want that movieclip delayed some so that "animation to play" can finish.

I would just call the second movieclip from the first animation but there are other buttons that trigger both "animation to play" and "another to stop" but trigger different delayed clips.

I have this:

Code:
on (release) {
_root.sat.beam.gotoAndStop(1);
_root.sat.gotoAndPlay(21);
var obj = new Object("_root.pages");
obj.interval = function(s) {
trace(s);
_root.pages.gotoAndStop(2);
};
setInterval(obj, "interval", 6500, "interval called");
}
and it actually works !!! but it keeps calling the interval at every "6500" after that. It does not seem to effect the movie in a bad way, but I only want it to call the interval once for every button release.

So I guess my question is if/how can this be achieved, or is there a better way alltogether?

Thank
Johnny

View Replies !    View Related
Action With Delay ?
Hello,
Does anyone Know?
I want to have a series of pictures slide from a movieClip on a button(release) state (NO PROBLEM) (Now my question is this , but I also want another movie clip to play on that button(release) state but I want it to start happening ONLY AFTER the first action is completed(after the right picture has slid into place.) What can I use to get this to happen?
Thanks.

View Replies !    View Related
Delay An Action
how can i get script to delay an action??

View Replies !    View Related
Delay Action
I have a button called btnGo. Whe it is clicked an animation starts. How can i put a delay in so that the animation starts 2 seconds after i click the button?

thank you

View Replies !    View Related
Delay Action
How can i amek this animation start not when the clip is loaded but something like 40-50 frames later?



onClipEvent (load) {
easeSpeed = 8;
target_x=70;
}
onClipEvent (enterFrame) {
_x += (target_x-_x)/easeSpeed;
}

View Replies !    View Related
Delay Action
How can i amek this animation start not when the clip is loaded but something like 40-50 frames later?



onClipEvent (load) {
easeSpeed = 8;
target_x=70;
}
onClipEvent (enterFrame) {
_x += (target_x-_x)/easeSpeed;
}

View Replies !    View Related
Delay On Mc Action
Is it possible to delay the action of a button within an mc?
Basicaly I want the animation in the mc to run fully before taking me to the desired scene.
heres what I've tried, but no joy.
heyyyellppp!


// Button1
button1.onRollOver = function() {
movie1.gotoAndPlay(2);
};
button1.onRollOut = function() {
movie1.gotoAndPlay(59);
};
button1.onPress = function (){
movie1.gotoAndPlay(34);
};
if (getTimer()>timePressed+300) {
button1.onRelease = function (){
gotoAndPlay("profile",1);}
};

Cheers
Dope

View Replies !    View Related
How To Add Delay In Action Scripts
Actually I want to add delay in action script like in c++ we have keyword delay(5000) ...how should we do that in flash.......? keep in mind that I am not talking about delays between frames

View Replies !    View Related
Frame Delay Action?
Is there an actionscript to put a delay on a frame of the timeline.

View Replies !    View Related
Delay A Button's Action
Ok, I'm a total beginner to flash so bear with me

I have a movie for my website that plays and at the end a button pops up to access the site. There's a sound that plays with the button, but I need to know how to delay the button sending you to the webpage so the sound can finish playing. About 3 seconds delay is needed. Is there some way that I can make the button wait to send me to the page?

View Replies !    View Related
Delay Action Is Beating Me
I have a movie clip that comes to meet the mouse when the mouse hovers over the botom portion of the stage. The clip is scripted to move only along the x axis. When the mouse leaves that bottom area, The movie clip flies off the stage to the left or right, depending on which is closer.

What I want the movie clip to do is wait a few seconds before it flies off the stage when the mouse leaves the bottom area. That way if the mouse wanders from that area for a second or two, the movement of the movie clip won't be annoying. Here is my code:

onClipEvent (enterFrame) {
if (_root._xmouse<795 && _root._xmouse>05 && _root._ymouse>405 && _root._ymouse<445) {
var distance = _root._xmouse-this._x;
if (this._x != _root._xmouse) {
this._x += .15*distance;
}
} else if (this._x<401) {
var homing_distance = -120;
if (this._x != homing_distance) {
this._x += .15*homing_distance;
}
} else if (this._x>400) {
var homing_distance= 820;
if (this._x != homing_distance) {
this._x += .02*homing_distance;
}
}
}


I have been messing with gettimer, but I can only get the delay to work once. I think set interval might be the key. Please help, this is driving me nuts!

Thanks

View Replies !    View Related
Delay An Action From A Button
Howdy,
I am using Flash MX in OSX, and I have a parent MC on the stage whose X and Y position is controlled by five buttons. Each button tells the MC to move to a certain position on the stage when clicked (i.e. positions 1-5).
When I click on button4, the main movie goes to position 4, and a child MC plays.
If I then clicked on button 3 to move the parent MC to position 3, I want the child MC to finish playing (or close) before the parent MC moves to position 3 on the stage.
How do I do it? Any ideas?
The child MC does not have to be within the Parent MC. I can put it on the main timeline if required.
I would appreciate any help.
Cheers
Boxx42

View Replies !    View Related
Delay Mouseover Action?
Hi Everyone,

I have a horizontal menu bar that is made of buttons that when you mouse over them, a horizontal sub nav bar drops down with additonal options.

The problem: if you accidentally "touch" a neighboring button with the mouse, it drops down that buttons menu.

I'd like to make a delay such as:

if mouse is paused over button for specified time, then play movie clip.

Here's my site: www.pointofgrace.com/site

Macromedia's top nav does what I'm trying to do: http://www.macromedia.com

Can anyone provide me with the actionscript to make th menu bar function that way?

Thanks in advance!

Lance

View Replies !    View Related
Delay A GotoAndStop Action
I am creating a quiz where the user must obviosly answer questions. After selecting the correct answer the user receives a short piece of text feedback. At the moment they then have to click on a button to move onto the next question. I would prefer to give them a short period of time to read the feedback - five seconds or so - and then automatically move onto the next question. The questions are on different frames on the timeline so I basically need to delay the gotoAndStop action for a few seconds. Is there an simple way to do this?

View Replies !    View Related
Delay In Action Script
Hi,

I am drawing a line dynamically in actionscript (lineto), based on calculations at runtime, but the line is being drawn too quickly. How can I slow it down/delay it?

Thanks

RTB

View Replies !    View Related
How To Delay An Action After A Click?
Is there an action that will count clicks of the mouse and perform after a certain amount has been reached?

I'd like to have the user click on an array of objects at random and after the third click, it then goes to a url. I've seen banners ads do this recently and am trying to learn how.
I'm an action script newbie, but can learn.

thanks!
-Joe

View Replies !    View Related
Delay Action By Frames
How do you delay an action until a certain number of frames?
on (release) {
play();
function loadIn(movie) {
content.loadMovie(movie);
clearInterval(loadInterval);
}
loadInterval = setInterval(loadIn, 200, "musical/interviews/peteteo/peteteo.swf");
}

This is the code for milliseconds, however, its not efective.

any clues?

View Replies !    View Related
Timer To Delay An Action
Hello,

I'm working with flash 8 and I have a 100sec soundclip that plays with the images at 12fps. Problem is the sound invariably ends before the images. I don't mind sound/image being out of synch -I just want the images to cut off regardless of where they are when the sound ends. Any suggestions?

I wonder if it is possible to create a kind of an actionScript timer that counts actual seconds rather than # of frames so that after pausing/sleeping/waiting 100sec's, the action gotoAndPlay(frame label) is executed. Is this possible or is there a better way around the problem?

Any help would be greatly appreciated.

-Llyfre

View Replies !    View Related
Inserting A Delay Before Action
hi,
how do i add a few seconds delay so that a sound on a button can finish playing before the on(release) action takes place?
thank you for your help!!

View Replies !    View Related
Delay Action By Frames
How do you delay an action until a certain number of frames?
on (release) {
play();
function loadIn(movie) {
content.loadMovie(movie);
clearInterval(loadInterval);
}
loadInterval = setInterval(loadIn, 200, "musical/interviews/peteteo/peteteo.swf");
}

This is the code for milliseconds, however, its not efective.

any clues?

View Replies !    View Related
Navagation System - Delay Action?
OK, I've been racking my brain for a couple days tryin to figure out how to get this to work, and have come to the conclusion that I need some sort of delay action. I've tried to accomplish this with a do while statement, but was unsuccessful, here's my script (ive included line numbers to help describe):


01 on (release) {
02 if (currentwindow=1) {
03 _level9.btunav.gotoAndPlay("close");
04 }
05 _level9.btunav.gotoAndPlay(1);
06 currentwindow = 1;
07 }


What I need to do is delay after line 3 executes, to prevent line 5 from executing too soon. I realize this script seems redundant but the IF statement is incomplete and I wanted to make sure I had the thing working before I went and coded the entire thing...

But anyway, if someone can help me out it'd be appreciated....

-CK

View Replies !    View Related
HELP: Delay Of Action In Running Timeline
hello all,

i read this script or tutorial some months ago and did not download it (S***) but mayby anyone of you has mastered the following and can mayby help me....

its the following, i would like to execute a buttonAction from the main timeline(scene 1),like "goto and play scene 2" (or something)

when i click the button;
from that moment on this buttonAction needs to be delayed while my main timeline starts playing till a certain frame, like 10 frames further on my timeline(scene 1). when my timeline has reaches a certain frame the buttonaction needs to be executed.. so my my movie will go to scene 2

does anyone know this or if it is possible.. plz help
or even better has the tecnote for me ..

desperately breaking my head
lol
thanx already

raoul petrus

View Replies !    View Related
Button Delay Action Help Needed
I have 5 buttons and 5 movies to load. Each movie enters and exits with movement. I need the buttons to tell the movie to play its exit action and at the end load the movie associated with that button. I have used the gotoAndPlay then loadMovieNum commands but both are executed immediately and the exit activity is not shown.

Can anyone assist me. thanks

View Replies !    View Related
Is There An Action That Lets U Delay The Timeline?
i have a flash movie designed frame by frame and its got a lot of frames. i need to go to the begininng to add a sound loop (its going to be looped 3 times) and i dont want to have to push the entire movie and all its layers back several frames.

ideally i'd like to just put an action in the movie at a certain frame that will make the whole movie kinda delay for a certain amount of seconds/frames (until the sound loop is finished) and then resume again. is this possible? is there a better way?

View Replies !    View Related
How To Delay An Action In OnEnterFrame Function.
Hi all,
Im still working on my platform game, for my last dat I hope i just need one little piece of code;
I got an onEnterFrame collision detecter. Now I got a function removeHard.
When my enemy hits my hero there is a variable "hit" that gets set to 1.
Now I have a function removeHard that removes one hard from my lives etc this fucntion works how its suppose to. Now what I need is as soon as the var hit = 1, the function removeHard gets called on once with a delay of lets say 1 second. The reason I need the delay for is becouse when I dont delay the character and the enemy move trough eachother and the function still gets called on repeadidly.

I hope someone can help me with this.
Thank you all in advance,
Grtz.

View Replies !    View Related
Delay Between Click And Performing Action?
is there a way to have a delay, say four or so frames between release and the time when the action takes place?

TIA
-Al

View Replies !    View Related
How Do I Make A Button Delay Before It Takes Action
Hi, I want to make a button do multiple things, but not simultaneously. I have a code here but its not finished. Any ideas?

this.onRelease = function(){
_root.HoldMain.loadMovie("URL");
//Here I want to make it wait 3 seconds before it completes the next function.
_root.HoldLeft.loadMovie("URL");
}

-Sergio
Soig@aol.com

View Replies !    View Related
Code To Insert A Delay Between The Event And The Action
I'm having a problem with coding...

I want to write a code that allows me to insert a delay between the event and the action, I mean, if I click on a button now, I want the instance of that button duplicated 3 seconds later... I know I can achieve that on AS, but I don't know how, can anybody help me???

View Replies !    View Related
Delay Action Script By 3 Sec At Mouse Hover (tooltip)
I have the following script witch workes great but i would like to run this script after 3 seconds after rollOver

Script for button:
on (rollOver) {
_root.tooltipL("Maak site normale grote");
}
on (rollOut, dragOut) {
_root.remove_tooltipL();
}



Script for frame
function tooltipR (string) {
xmouse = getProperty("", _xmouse);
ymouse = getProperty("", _ymouse);
duplicateMovieClip ("_root.tooltipR", "tooltip1", 1);
tooltip1.tooltip = string;
setProperty (tooltip1, _x, xmouse);
setProperty (tooltip1, _y, ymouse);
startDrag ("_root.tooltip1");
tooltip1.gotoAndPlay(2);
}
function remove_tooltipR () {
stopDrag ();
removeMovieClip ("tooltip1");
}

Thanks !

View Replies !    View Related
Hold Time Or Delay Timer In Action Script 3
I'm new to concepts of AS 3 but i'm stumbling through it.
So i'm looking to the Fourm for some Mentor ship

Here's my issue...
I have a simple Regular Flash slide show with 4 slides and an intro label

I need my Intro label to have a Timer or Delay event that holds on the "Intro" Label for a certain amount of time before the Timer expires and calls a function that tells FLASH to go on to slide "Slide 1" label.

The trick is i need this delay to run everytime the Timeline is at the "Intro" label as i have an animation playing while the timer or delay event counts down and finally at end goes to label "Slide 1"

Can anyone share some simple code snipets that would point me in the right direction to accomplish this using AS3 ?

Thanks in advance to the flash forum for the Mentor Ship

View Replies !    View Related
Creating A 'delay' So That A HitTest Action Doesnt Happen Twice Too Quickly.
Im making a game, and you lose a life if these little dots hit a line that you draw. Thats all fine and dandy, but whats happening is i lose several lives at once because there are 3-5 frames in which the dot crosses over the line.
Is there anyway to invoke a delay before anything happens? and obviously just 1 delay so that i dont lose 5 lives again, just a bit delayed.

Thanks,

Alex

View Replies !    View Related
Playing Only Next 5 Frames Without A Stop Action
Hello

Anyone ever tried getting a button to tell a MC to play the next 5 frames and stop? is that possible? I can't put a stop action in the movie clip because of how have this game/site set up.

any help or direction would be appreciated

cheers,

nigel

View Replies !    View Related
MC Playing In Revers On Buttons Action
Hi,

I have a movieclip on the main timeline. In the clip there are 3 buttons. When clicking on the buttons the first one starts the animation, the second stops the animation. No problems so far. But the third button is supposed to turn the animation around so it plays in reverse. This on I have no idea what script should be so I need help. 'prevFrame' doesn´t work cuz it stops on the previous frame. Could anybody plz give me a helping hand? I have MX.

I should perhaps say that I have searched for an answer without finding exactly what I need.

THANX in advance!

y.

View Replies !    View Related
Playing A Movie When No Action Has Been Taken For A Certain Time
Hi,

I want to find out a movie clip can be played when the user has not taken any action for a certain time ?

Lets say the user does not click on any buttons for a certain time, then I want a movie clip to start playing

Thanks

View Replies !    View Related
Playing Mp3 Url Like The Following Mp3.php?action=jump&id=17&catid=3
hi im i noob so if you could use simple terms that would be great.

firstly i need to now if it is possible to play a url like the following in flash

mp3.php?action=jump&id=17&catid=3

the following link will be an mp3 file. i would like to make a swf file that will play the file with all the stop start volume buttons etc...

also the 17 in the link to the mp3 file change depending on the file the user wants to play. would i be able to pass a varible into the swf as follows (or maybe someother way)

mp3.swf?var=numberoftrack

which in turn will play the following url within mp3.swf

mp3.php?action=jump&id=numberoftrack&catid=3


cheers in advance

Benj

View Replies !    View Related
Playing Sound W/ Action Script
is there a way to play a sound inside your fla/swf by action script
if it is possible is there a way to stop the sound?

thanks

View Replies !    View Related
Audio Playing After Stop Action
I have a stop action on a different layer, and have streaming audio which I would like to run throughout my movie, although when the stop action(which I have to have, because Im doing a presentation and I have different points of navigation which I need to stop at), but I want the audio to play in the background streaming?

How could I go about accomplishing this?

View Replies !    View Related
Playing Sounds In Action Script
why does the follwing code not work.


matrixSound = new Sound();
matrixSound.attachSound ("rushX1");
matrixSound.start()

I have used linkage to assign the name rushX1 the original file is an MP£ called rushX1.mp3.

I can get sound to play when put on the time line. why wont it work anyware within my action script.....I can also getthe script to work on the first frame of a blank movie.

But why dont it worked when combined with other action scripts or in sub-movies.


Thanks for reading.

View Replies !    View Related
How To Trigger An Action After A FLV Has Finished Playing
I have a FLV file that I am pulling into my SWF and I want to go to the next scene in the SWF once the video clip is finished playing... Because it's externally loaded I haven't been able to figure out how to do this. I tried just importing the FLV to the stage and putting it in the timeline, but that makes the SWF huge and the video playback is much slower for some reason.

Does anyone know how to do this?

View Replies !    View Related
Playing Music Through Action Script
i have this swf file where i play individual songs through actionscript

this is my code

1st frame

_root.music = new Sound();
_root.music.attachSound("file1");
_root.music.start(0,99);

1st button

_root.music.stop();
_root.music.attachSound("file2");
_root.music.start(0,99);

2nd button
_root.music.stop();
_root.music.attachSound("file3");
_root.music.start(0,99);

if i start the movie, it plays file1..*duh* i press button 1, it plays file2..and so on..this whole thing works locally, but it doesn't work on the internet. i posted it up on my webpage when it first loads, it plays like 1 sec of the music file and stops -_- why?

View Replies !    View Related
Playing A Sound Using Action Script
Can anyone help?...

I have just completed the playing a sound using AS tutorial:

on (release) {
kirupaSound = new Sound(this);
kirupaSound.attachSound("coolsound");
kirupaSound.start(0, 99);
}

i would like to add another button to the movie to stop the sound, I have tried replacing the start with stop but knew it wouldn't be that simple. Can anyone assist or let me know if there is a better method?

Many thanks

View Replies !    View Related
Playing Swf With Duplicate Action Inside Another Swf
I am trying to load an swf such as the 'snow' samples on kirupa into another swf.

When I do so, the duplicate action slows down to one at a time. The 'snow' swf works fine on its own, but not when loaded into another movie.

I know there is a simple solution. Does anyone have it??

Thanks

View Replies !    View Related
Playing Music Through Action Script
i have this swf file where i play individual songs through actionscript

this is my code

1st frame

_root.music = new Sound();
_root.music.attachSound("file1");
_root.music.start(0,99);

1st button

_root.music.stop();
_root.music.attachSound("file2");
_root.music.start(0,99);

2nd button
_root.music.stop();
_root.music.attachSound("file3");
_root.music.start(0,99);

if i start the movie, it plays file1..*duh* i press button 1, it plays file2..and so on..this whole thing works locally, but it doesn't work on the internet. i posted it up on my webpage when it first loads, it plays like 1 sec of the music file and stops -_- why?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved