ActionScript 3.0 :: Time Delay Inside While Loop?
Mar 19, 2011I'm trying to create pause functionality in my flash app.How would I go about doing this:
Code:
function pause(pauseTime)
{
[code].....
I'm trying to create pause functionality in my flash app.How would I go about doing this:
Code:
function pause(pauseTime)
{
[code].....
i have some loop function for the game, this loop for open the 9 box, here the code
function random_item_2(coinsx)
{
var listItem:Array = new Array();
for (var i:uint=0; i<15; i++)[code].........
the problem is, 9 box open in one time, not one by one, i want to box open the box one by one, after the first box opened so the next box will open, here for some algo that i wanted
How to make time delay in a loop..[code]But I want every containers_array[i] to be added one after another. I don't have them scaled to 100%, they remain being 1%, just like little dots on the screen when I write down:[code]
View 2 Replies(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?
possible to have a timer that works inside a 'for' loop? I have created a timer but it only activates each time the frame is run through. I have a for loop with i++ so that I can put objects on the page with a small pause between them. The i++ loop puts all the movieclips on the page simultaneously. I need a delay and a loop because the shuffled arrays will be reset each time the frame refreshes.
View 1 RepliesI'm writing an upload program to upload multiple files. It works great as long as I only upload one file but as soon as I add a second file it throws an error saying it can only perform one upload at a time.Is there a way I can have it not loop back through the for loop until the upload has completed?Here is a chunk of my code
Code:
for(var q:int = 0; q < selectedFileArray.length; q++)
{
trace("Loop marker 1");[code].....
I have some video which I have converted into .swfs I am trying to set delays to the three videos, so that the first swf plays on page load. The second loads after 30 seconds and the third after 45 seconds.
View 11 RepliesI want to repeatedly add a movie to the stage using add child so have created a loop to add it 30 times. How can I make it so they aren't all added at the same time. I'd like to be able to set an interval of time between them being added.
View 3 RepliesNow, before I get slated for asking this question, I have searched for the answer in this & other forums, but I still can't get my head around this.I need to have a delay built in within a "for" loop, so that it works something like this:
for(x=0;x<10;x++)
{
// code that generates button - I have this working
[code].....
I need to have a delay built in within a "for" loop, so that it works something like this:for(x=0;x<10;x++) code that generates button - I have this working delay of 75 miliseconds before continuing the loop - can't get this to work!!
View 1 RepliesIs there actionscrip to add a delay to something.
I click on a button, i want Movieclip1 to move to the right, then i want a 3 second gap and then i want Movieclip2 to move downwards.
Is there actionscrip to add a delay to something....
e.g 1.
I click on a button, i want MovieClip1 to move to the right, then i want a 3 second gap and then i want MovieClip2 to move downwards....
So on frames 10, 20, and 30 on my timeline I have these llines of code on each of them respectively:[code] This essentially "bounces" on my images. Can someone give me direction on how to set up a delay to make this happen all on one frame?[code]
View 1 Repliesdoes anyone know of any actionscript i can use for a time delay. Say you have only 3 frames on a time line is there some way using actionscript that i can delay the playhead so for instance it stays on each frame for 20mins and once that time is up it moves on to the next frame and so on and so on.
View 9 RepliesHow would you get an animation to loop with a delay in between using AS3?
View 1 RepliesI'm querying Rotten Tomatoes' API for movies listed in an XML document. The problem I'm having is, whist iterating through and querying for each movie I'm hitting RT's API limit which, in turn, is throwing an IO error. Is there a way I can delay execution in a loop for about a second or so, to avoid this?
View 1 RepliesIm new to action script and am just starting to understand it. Im trying to create a loop with a delay in it but am not having much luck passing growing variables to the new function.
[Code]...
I have a loop that places 5 movie clips on the stage and they all start playing at the same time. I want to see if i can use the loop variable to offset the movie clips so they are all out of sync.Delay movieclips in loop from each other?
View 2 RepliesI have 100 dynamically generated clips on a stage.
I want to remove the clips one by one over the course of a few seconds.
Can I put a delay into a while loop to make it only loop every 50 ms or so?
I have a rotating menu that when clicked rotates and loads in swf movies, OnClick.
The problem I seem to be having is that because the swf movies load in on click it seems to be causing the rotation of the menu not to run smooth.
Question: Is it possible to get the swf movies to load in once the action of the click has completed its action. some kind of 2 second delay before the movies load in??
what happens: you can click or mouse scroll through the menu, when you click, the action repositions the selected Item (ActiveItem) in the center and resizes larger. this works great, is it possible after this action is complete to then load in the swf movies?
to see how the movie runs at the moment this is the link: [URL]
you will see at the moment onClick the movies load straight away which makes the rotation not smooth when rotating around.
I can't seem to get the mouse scroll to work the same function as the click at the moment also.....thats for another day
Is there any way to change the delay time. i used a variable to set the delay time but it wont works for me. The delay time is Working as the previous value.Here is my code.
ActionScript Code:
var delay:Number = 1000
timfun()
[code]....
I have a short animation mcl that has an enter button (loader) on it. Once clicking the enter button, the main website content (another swf) loads. For some reason when users click the enter button, there is a 12+ second delay in loading the content swf
View 1 RepliesI need to know how we can create a menu with time delay. Mouse down, disappears after three seconds, move mouse the menu appears.
View 1 RepliesThe code show's the movieclip "nav" when "bg_inv" is clicked, and fades it out when 5 seconds have passed. What I want to achieve is this:When I click a button inside "nav" called "next_btn" the delay needs to be reset, so that "nav" doesn't fade out until five seconds have passed since I clicked the button.
Code:
nav._visible = false;
import mx.transitions.Tween;
import mx.transitions.easing.*;
[code]....
I need to load 3 SWF's file after a certain period of time (loading first SWF, see 5 sec and loading next SWF, see this SWF 2 second and loading Final.swf and stop load)
View 3 RepliesActionscript Code:
function wait() { stop(); var myInterval = setInterval(function () { play(); clearInterval(myInterval) }, 5*1000); // stop for 5 seconds}
[code].....
Since my earlier post might not have been clear I have made some changes to the uploaded example Fla. I am struggling with the delay from the xml slideshow in this tut: [URL] Everything works fine when publishing the swf from the slideshow flas. The problem happens when loading these swfs into an mc of another fla (the "mockup fla" in my example) The example mockup swf loads 2 slideshow swf�s . Swf 1 contains 3 jps and swf 2 contains 1 jpg. When loading swf 1 first, the only jpg for that slideshow is loaded (yes, only loading one pic for a slideshow seems strange but this is just to clarify the issue). Everything works fine so far. Now I load the the first slideshow swf with the corresponding button. The 3 jpg�s load and loop with a delay like planned. All good. Now load the 2n�d swf again....... now the single jpg always loop reloads. Why is this happening?
[Code]...
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].....
I've been having some trouble with this line of code. This is being used in an .as class file for my Ball class. I can get it to move within the main .fla by using a timers but if possible I would rather avoid the timer. I'm trying to develop a system for my FLA like this:
Ball starts at x,y
Ball moves to waypoint x,y
Ball leaves stationary copies of itself along the way forming a line as it goes.
The file will do this several times so I am trying to base this on if/else rules rather than animate it out. I feel like I should contain all movement activity within the class file and leave the waypoint rules for the main .fla. My current issue is that the code below (without the hittest) works if the FLA has a timer triggering the moveTowards function. Without the timer in the fla, it still works but the ball just warps to the destination.So I have two questions:
Is there a way to control the while loop so that it pauses at the end of each loop enough to look like the ball is moving incrementally?Is there a way for me to have a drawball function within the ball class itself or should I make a new package/class within the class file? Ideally I would have the new ball creation be relative to the "step" variable.
Code:
public function moveTowards(pX:Number, pY:Number, step:Number)
{
var dir:Number = Math.atan2(pY - y,pX - x); //find angle direction[code]...........
When a page appears I want to delay the appearance of the button so users stop to see the animation i have put there but the help file just tells me how to create classes when I'm sure there must be a few lines of code to do it? can someone tell me what is wrong here as when I make the alpha of the button to 0 the whole page becomes 0 alpha and it wont do anything or give out any errors[code]...
View 1 Replies