How Do I Make An MC Wait A Random Amount Of Time Before Looping?
Basically I have an 80 frame movie clip that I want to stop at frame 80, wait a random amount of time (say between 1 and 5 seconds) before it does gotoAndPlay(1).
My thanks for any aid to this little issue
FlashKit > Flash Help > Flash Newbies
Posted on: 03-22-2006, 05:16 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
What's The Function That You Use To Wait For A Set Amount Of Time?
Searching this board for some keywords I'd think would be helpful, I came across setInterval(), but I can't seem to make it do what I want. Also, I seem to have to put a function as one of its parameters, whereas I simply want to insert a number into it and have it wait that long.
All I want to do is just make my code wait a while, then continue. So, basically, I'm looking for something like delay(3000); to wait 3000 milliseconds.
If you want some context on what I want to do, my Script creates a new movie clip, which scrolls onto the screen, where I want it to wait a few seconds, and then it continues off the screen.
Random Movie Clips To Play For Random Amount Of Time
hi,
i am loading external movieclips randomly into 4 seperate emptymovies, i now need a way to get these random clips that i am loading to play for a random amount of time and then load the next clip.
i need some help with the code...
how do i get the clips to loop, then assign each a random number and have flash check if the random num is = to current frame...if it is, have that clip stop and a new one load?
i have no idea how to write the code for this
any help would be great
thanks
this is what i was given so far..but don't know what to do with it.
Code:
var rnd = Math.round(Math.random(mc._totalframes));
mc.onEnterFrame = function() {
this._currentframe >= this._parent.rnd ? unloadMovie(this) : null;
}
Allowing A Certain Amount Of Time Before Looping Back To Main Swf File
I have several swf files (main.swf and file001 to file013.swf) for a demo. The main.swf is the start and loads the file001.swf using loadMovieNum. The other swf files load from the previous one using loadMovieNum also. In the last one (file013.swf) there is a button on the last frame which the user can press to launch a program. If the button is not pressed then the demo should loop back to main.swf. My question is how do I allow a certain amount of time to pass on that last frame in file013.swf before it loads back to main.swf?
Movie Clip Starting After A Random Amount Of Time?
How do I make a movie clip play after a random amount of time, wait until it (the animation itself) has reached its last frame and wait a random amount of time until it starts again ?
any help would be greatly appreciated,
thanks in advance
How Do I Make Flash Stop For A Certain Amount Of Time?
hey, I want to make a timer.
what I mean is that I want to make a frame stop for
a number of seconds and that continue to the next frame
or whatever command I give it.
for example, like a slideshow.
to make flash wait in a certain frame for 10 seconds, and
than goto the next frame, of jump to another frame or whatever
command I give it.
thanks alot!!!
How To Make A Video Pause After A Certain Amount Of Time
Hi,
I have a thumbnails/listbox/XML video menu setup using AS 2.0 from the http://www.macromedia.com/devnet/mx/fla ... nload.html tutorial.
What I would like to do is stop the videos playing after a certain amount of time - ie a value read in from the XML file...
I have setup the flv's to have cuepoints - but although these are triggered the command ns.pause() does not activate :?
Any clues?
Thanks
Pete
Wait Random Time
O.k basically what i have is a game where stick men hide and pop out, shoot you and take cover again. At the minute i have a kind of thing that everyone pops out at the same time!!! i need a script that makes the Movieclip stop for 2-10 seconds then play again.
Can anyone help???
I Won’t To Make A Lottery With Random Amount
Could someone help me with this matter?
I won’t to make a lottery with random amount
Example 100,200,500,1000
3 numbers would appear at the same amount
Example 100, 100, 100
Is there a god action script ho could execute this
Can I Make A Function Wait For A Period Of Time?
Hey everyone
I just wanted some idea's on how best to tackle this problem in actionscript.
All I want is that when a button is pressed it fades out the current page and then fades in the new page to be displayed. How ever when trying to fade out the current page i doesn't because it goes to the label and starts to play but the next part of the script tells it to go straight to the label to load the new page. Does anyone have a clever way of making it wait till the current page is faded out?
If worse comes to worse can I just make it wait a set period of time before fading in the new page?
Ive attached a bit of the current code and comment it with where the current page is faded out.
Thanks in advance for any help
Gaunt
Attach Code
function homeClick(event:Event):void {
if(prevPage != "home")
{
if(prevPage == "advertising")
{
// Here is where the current page is told to fade out
MovieClip(this.parent).pages_mc.gotoAndPlay("advertisingEnd");
}
else if(prevPage == "websites")
{
// Here is where the current page is told to fade out
MovieClip(this.parent).pages_mc.gotoAndPlay("websitesEnd");
}
MovieClip(this.parent).pages_mc.gotoAndPlay("homeStart");
prevPage = "home";
}
}
Wait On Frame For X Amount (help Please)
Below is the code I am using....
SMALLER MOVIE 1
myFrameMove1=function(){
transitionbox1.play();
}
myInterval1 = setInterval(myFrameMove1,3000);
gotoAndStop(1);
clearInterval(myInterval1)
SMALLER MOVIE 2
myFrameMove2=function(){
transitionbox2.play();
}
myInterval2 = setInterval(myFrameMove2,3000);
gotoAndStop(1);
clearInterval(myInterval2)
I have a MAIN movie that has two buttons
each button loads a SMALLER MOVIE into place
the two SMALL MOVIE each have a setinterval
delay transition, this seams to work as long as
you do not view each movie more than once
in other words
click button 1
click button 2
and than click on button 1 again
after yo do this you will see the delay becomes sparatic
and changes at no set time.
There is a source file that will help
Please Help, Anyone!!!!!!!!
Wait On Frame For X Amount Of Seconds
I am creating a photo transition and instead of using 100's of frames
I would like to ad an action that tells flash to wait on a frame for a certain amount of time.
Any suggestions?
Flash Timer? Wait X Amount Of Seconds, Then Gotoandplay
i basically need to reduce the size of some movies. so im thinking of cutting down on tweening and frame amounts, and basically pausing for 5 seconds or so, then playing another movie. instead of tweening for 60,000,000 frames then moving on.
any ideas?
Looping A MC For A Certain Amount Of Times
Pretty please....anyone....
What I am trying to do is I want my MC to loop for five times and then jump on to another frame (where the fadeout starts)
I have been trying my luck with a if else statement checking wether the variable loop has reached the value of 5 if yes I want it to jump on. I don't get any errors in the output but the darn thing won't stop looping...
can anyone help me please...?
How Do You Make This Random Moving Object Disappear After A Certain Time
Hi all!. I've just finished using this bit of simple code to get an object to move around randomly. I want to try and get it to disapear or move off the stage after say a minute (with a countdown clock in the corner starting from a minute and counting down). Anyone with any ideas on how to accomplish or approach this? Thanks!
How To Make This Random Moving Object Disappear After A Certain Time?
Hi all!. I've just finished using this bit of simple code to get an object to move around randomly. What I want to do is try and get it to disapear or move off the stage after say a minute (with a countdown clock in the corner starting from a minute and counting down). Anyone with any ideas on how to accomplish or approach this? Thanks!
Looping A Specific Amount Of Times?
is there a way to specify in html how many times the flash file can loop without writing AS for it?
Ie <param name=loop value=true> <--- can that be changed to a number?
thanks in advance,
mcm
Doing Something After A Certain Amount Of Time?
Hi there
I was wondering about the concept of executing code after a certain amount of time...
is this possible?
say, like count up 5 seconds, and then do something once the count reaches 5
you can do a for loop to count upto a finite number of say 1000, but whose to say how long that will take and it'll obviously be different depending upon the speed of the machine...
Doing Something Every X Amount Of Time
i'm trying to get an action to be performed every x amount of seconds but i'm totally lost how to do this.
i know the getTimer() function returns a time in milliseconds but where am i supposed to put the code?
please help!
Loading Swf After Certain Amount Of Time
Hi,
I've created flash movie that loads a new swf after the current swf plays through. However, i'd like for the new swfs to load say... 30 seconds after the current one finishes, rather than immediately.
Rather than adding a long set of frames to each swf, I'm assuming there is a better way with actionscript to control how often/frequently a swf loads.
Any suggestions?
cheers!
Jen
Pausing/Waiting For A Set Amount Of Time
I'm pretty sure theres some function to make it so that Flash pauses in the code for a certain number of seconds/milliseconds, but I can't find it in the help. Anyone know it and the syntax?
Calling A Function Every Amount Of Time
I want a function to be called every certain amount of seconds ... and Ill eventually want it to be a random number between like 2-10 seconds ... how would I do that?
Stopping A Frame For Amount Of Time
I have a movie I'm making and I need to have the movie hold at frame 20 for 4 seconds then continue to play the rest of the movie. Can anyone shed some light on this? Thank you so much.
Makin A Key Disable After Certain Amount Of Time
is there a way to make the ctrl key disable after like 1 sec, so my players on this game im making cant just hold down control and kill everything.
In addition, is there a way to make an object randomly fall in different places. thx
Stop For A Certain Amount Of Time Then Play
this is what i am trying to do.
i am trying to have a flash file that will load audio.
play the audio in the file
wait till its done.
reload the page its embeded in.
as a temp solution i have this as my action script.
s = new Sound();
s.setVolume(50);
stop();
and in the properties i have this.
Sound: (sound file)
Effect: None
Sync: Start Loop
but this as you can see doesn't reload the page.
also the way i have it set does flash wait till the file is completely loaded till it starts playing or does it automaticly goto the stop and just wait??
because i would prefer the flash file to wait till the sound is loaded so the page wont reload pre maturely
Stop On A Keyframe For A Set Amount Of Time
Hello all - hopefully a noobish question here with an answer my noobish flash mind can understand.
What I would like to do is stop the movie playback on a selected frame for an amount of time that I can set before the playback continues on. Is there anyway in Flash to do this?
Thanks
- Brian
Goto Next Frame For X Amount Of Time
hey,
i'm looking for some code that stays on a frame for a certain amount of time and then goes to another frame, stays for a certain amount of time and so on.
Action Occuring After A Set Amount Of Time.
how is this done?
im assuming "getTimer();" is used and "random();"
but in what context?
something like:
code:
_root.onEnterFrame = function() {
timer = getTimer()/1000;
if ((timer) = .25) {
do action
}
}
};
where does the random number code go#
basically i want the timer to start counting down from a random time of max about 3 seconds until it reaches 0.then an action occurs
any help is appreciated
thanks
cobhc
[F8]Most Amount Of Sounds Playing At One Time?
Trying to produce a piece of work which could require the use of up to 100 sounds at once, however, I am finding that it won't play more than 32 samples at one time, is this a restriction in Flash as to the amount of sound channels that can br used at any one time or a memory typed limitation??
If it is Flash, what is the maximum amount of sounds that can be simualtaneously playing at any one time?
[MX] Stay On Frame For A Certain Amount Of Time
I have a movie with 5 labelled frames, each with a stop action.
I just want to have an animation that sits on Frame1 for 10 seconds, then goes to Frame2 for 10 seconds, then goes to Frame 3 for 10 seconds, etc etc....
how do i create a function that does this?
Counting Dynamically In A Specified Amount Of Time
Hi everyone!
I have searched high and low for a script in flash i can use that counts up to whatever number i set in a specific amount of time that I specify. I have found scripts that count down and up acutally but they are not easy to edit or specify the number to stop at and in what amount of time. Could someone please help?
Quick example would be the counter counts from 1 to 280,000 in 20 seconds.
I would really appreciate the help!
Oh, using flash mx 2004, btw.
Thanks,
shines
Move Object In Amount Of Time
Hi,
I have a class where a circle moves from one point to another (straight line).
I want to make it move in some amount in time. For example to move from one point to another in 2 seconds.
Now it moves in some miliseconds (_timer = new Timer(50)) and moves in small periods.
So, can someone advice how to make it move in some amount of time?
Thanks
Disabling Buttons For A Certain Amount Of Time
I was wondering if there is any way in flash, that you can disable a button for a few seconds, so that it cannot be clicked again.
You see i am using dynamic transitions to load external swf's, and if the user clicks a button whilst the external animation is playing nothing will happen, giving them the impression that the button doesn't work.
Any help would be appreciated.
thanks
Pausing For Set Amount Of Time Then Autoplay...
Hi all,
This seems like a simple question but I can't seem to find the answer anywhere.
I'm looking to have 3 JPEGS alternating as background for my flash movie every 30 seconds or so. Is there a simple way to do this (within a movie clip) that won't require 30 seconds worth of frames between JPEGS?
I guess if I could make an analogy- in imageready, when you're making animated gif's, you can tell a frame to pause for a specific amount of time. Something like this I suppose.
Also, these are very large photos (70 kb). Anyway to optimize this entire operation so people won't have to wait for all 3 to download with the .swf?
ALSO! - I should probably start a new thread for this......I'd like to have one of the three images randomly load first (random number generator telling it what frame to visit?). Then they can progress in their usual order, but I'd like to change things up a bit with a new image each time a visitor comes to the site.
Thanks in advance everyone!
Press Button Within A Certain Amount Of Time Or....
I did this about a year ago, but I have lost the .fla, and I can't remember the code...
If you press a button within a certain amount of time, you are taken to lets say frame 2, if the time expires, you are taken to frame 3.
I have used up all of my "i'm still a newbie at flash", so I'm just gonna tell you the truth and say that I haven't done any AS (or flash for that matter) in quite some time, so I guess I have to get busy and learning actionscript again so I don't have to bother you kirupians so much
Reloading A Picture At A Set Amount Of Time
is there a way to have a picture refresh every 3 seconds?
i'm trying to make a flash page for my desktop background, and i want a webcam on it... i went through their source and found out that it's actually just a picture that's resaved and reloaded every 3 seconds, but they did it with java...
thanks
Disabling Buttons For A Certain Amount Of Time
I was wondering if there is any way in flash, that you can disable a button for a few seconds, so that it cannot be clicked again.
You see i am using dynamic transitions to load external swf's, and if the user clicks a button whilst the external animation is playing nothing will happen, giving them the impression that the button doesn't work.
Any help would be appreciated.
thanks
Pausing For Set Amount Of Time Then Autoplay...
Hi all,
This seems like a simple question but I can't seem to find the answer anywhere.
I'm looking to have 3 JPEGS alternating as background for my flash movie every 30 seconds or so. Is there a simple way to do this (within a movie clip) that won't require 30 seconds worth of frames between JPEGS?
I guess if I could make an analogy- in imageready, when you're making animated gif's, you can tell a frame to pause for a specific amount of time. Something like this I suppose.
Also, these are very large photos (70 kb). Anyway to optimize this entire operation so people won't have to wait for all 3 to download with the .swf?
ALSO! - I should probably start a new thread for this......I'd like to have one of the three images randomly load first (random number generator telling it what frame to visit?). Then they can progress in their usual order, but I'd like to change things up a bit with a new image each time a visitor comes to the site.
Thanks in advance everyone!
Action Occurs After Amount Of Time For Menu Mc
I have a menu mc, with animations inside. I would like it so when the mc loses focus, after a certain amount of time an action is performed. The action being performed will take the playhead to a certain frame inside the mc. How would I go about doing this?
Making A Window Close After A Specified Amount Of Time
hi. how can i go about making a window close after a specified amount of time? after pressing a button named "end" on my page, i have an animation i want to play, and as soon as it's through playing, i want the entire window (website) to close. the window is not a pop-up, it's actually the website itself. i want it to stay open for approximately 4 seconds after pressing the button before it all closes down. any help would be very much appreciated. thank you!
p.s.- forgive any ignorance on my part in the forming of this question, or the wording used within. i know very little about flash at all. my girlfriend is making a webpage for my band and is having a hard time figuring some things out. so i'm trying to help her. she will completely understand your answers.
Coding For Date & Time + Showing The Amount Of Guests
Hey sup people, Im building a new flash interface, and I've always wondered what the coding was to show the amount of guest users that are on your flash site at any given time. Aswell, Im looking for coding to show the current date & time in EST for flash apps. Any help, tutorial links, suggestions, and or .fla's would be great !
Script To Stop Movie For Designated Amount Of Time?
I'm setting up a Flash file that will basically operate as a presentation on the site's home page. The swf will load in a sequence of movies that the viewer will not have control over.
Is there a way to stop these external movies for say, 20 seconds, before it loads in the next one.
Or should I just put in a "go to next" control for the viewer? (really don't want to do this)
Loading External Movies For A Specific Amount Of Time
hello,
I used the "loading random movie" tutorial (http://www.kirupa.com/developer/acti...dom_movie2.htm) to load 3 external movies. It worked great.
But now, my client wants the movies to load one after the other. Each movie is interactive, but requires you to click on it, so it plays an intro and stops. Each movie is built exactly alike. So, I would like a movie to play, then stop for a certain length of time (long enough for the user to read some text). If after that length of time, the user does not intereact with the movie, then I want the next movie to play in it's place. If the user does interact with the movie, I want it to just stop at that movie.
Thank you in advance for your help!
User Defined Random Amount
i want to have an input amount that a user can put it to define how much random there is.
Code:
on (release){
var i:Number = Math.ceil(Math.random()*//i want this to be whatever the user enters in the input box\);
gotoAndStop(i);
}
any help would be appreciated
Random Movement On X Amount Of Sprites
I'm using this class to create random movement on a sprite however when I add another sprite its random movement is the same as the first sprite and they end up sitting on top of each other. Could anyone point me in the right direction as to where I'm going wrong with this.
ActionScript Code:
package { import flash.display.Sprite; import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.events.Event; import flash.geom.Point; public class Nodes extends Sprite { private var _particles:Array; private var _numParticles:uint = 2; private var _targetX:Number = Math.random() * stage.stageWidth; private var _targetY:Number = Math.random() * stage.stageHeight; private var _ease:uint = Math.random() * 5 + 20; public function Nodes() { init(); } private function init():void { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; _particles = new Array(); for (var i:uint = 0; i < _numParticles; i++) { var particle:Ball = new Ball(5, 0x62C1AF); particle.x = Math.random() * stage.stageWidth; particle.y = Math.random() * stage.stageHeight; particle.x = _targetX + Math.random() * stage.stageWidth; particle.y = _targetY + Math.random() * stage.stageHeight; addChild(particle); _particles.push(particle); } addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(event:Event):void { for (var i:uint = 0; i < _numParticles; i++) { var particle:Ball = _particles[i]; var _moveX = _targetX - particle.x; var _moveY = _targetY - particle.y; particle.x = particle.x + _moveX / _ease; particle.y = particle.y + _moveY / _ease; if (Math.sqrt(Math.pow(_moveX, 4) + Math.pow(_moveY, 4)) < 15) { this._targetX = Math.random() * stage.stageWidth; this._targetY = Math.random() * stage.stageHeight; } } } }}
Cheers
Whats The Coding For Date & Time + Showing The Amount Of Guests
Hey sup people, Im building a new flash interface, and I've always wondered what the coding was to show the amount of guest users that are on your flash site at any given time. Aswell, Im looking for coding to show the current date & time in EST for flash apps. Any help, tutorial links, suggestions, and or .fla's would be great !
Load Movie Clip After A Certain Amount Of Time/frames Played
I'm making a site out of flash with different sections accessed from a main menu. I'd like to be able to access any section from any section. Each section has an into and outro. I'd like the section to intro in, display the info, and then when another section is selected have the current section outro before the next one intros. All of this with externally loaded swfs inside a movie clip. So i need a button (set in the main movie) script that does this in plain english:
On release play currently loaded external swf for "N(frames or seconds)"
Then load this external swf into the same container to replace the previous one.Is it possible, or is there a better way of going about this? Thanks!
HitTest On Random Amount Attached Movies
onClipEvent (enterFrame) {
var gang1 = _root.world.gang1Amount;
for (i=1; i<=gang1; i++) {
if (this.hitTest(_root["gangA", "gangA"+i, i].mygang1.mySpace, true)) {
_root[gangA+i].mygang1.mySpace.gotoAndPlay(30);
} else {
gotoAndPlay(30);
}
}
}
This doesn't seem to work...
Can anyone tell how to do this right.
Basically the the file beforehand and attached a random amount of movie clips (world.gang1Amount. Now, I want to be able to detect if they collide with each other..does this make any sense...
Because I've genrated a random amount i'm trying to hittest a that amount (this.hitTest(_root["gangA", "gangA"+i, i].mygang1.mySpace, true)) ....is this the way to go?
please help me..stu
Wait Time
i looked and i couldnt find it... does anybody know how to set up a code that makes it wait for maybe 5 seconds and then trigger an action?
-jarredchili
|