ActionScript 2.0 :: Repeat Function After X Seconds?
Nov 21, 2010I jst wonder if I could make the object "car" to repeat doing this:
ActionScript Code:
function start_car(){
_root.car.onEnterFrame = function(){
[code].....
I jst wonder if I could make the object "car" to repeat doing this:
ActionScript Code:
function start_car(){
_root.car.onEnterFrame = function(){
[code].....
I just wonder if I could make the object "car" to repeat doing this:
function start_car(){
_root.car.onEnterFrame = function(){
_root.car._y +=15;
};
};
setTimeout(start_car, 1000);
I want it to begin at y=0 and x=0 after like 7 seconds and then repeat going down the y axis as you can see in the code.
So the car movieclip starts moving slowly from the top going down then after like 7 seconds when it's out of the scene it begins at e.g x=0 y=0 and going down for 7 seconds then starts at x=0 y=0.... etc, so it keeps looping.
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]....
I want to repeat the function when you MOUSE_OVER it..
Code:
p_rechts.addEventListener(MouseEvent.MOUSE_OVER, rechts);
function rechts(e:MouseEvent) {
stoel.collada.rotationY -= 5;
}
now the "stoel" rotates 1 time -5, but i want it to repeat itself, till your mouse is of the button..
I have a simple function on the main timeline which applies to 50 moveiclips, named MovieclipA1 to MovieclipA50. [code]The code is the same for all 50 mc's. All that changes is the 'A1' which become A2,A3,A4,A5 etc.Is there anyway to avoid writing this code 50 times, perhaps using an array which contains A1 to A50?
View 7 RepliesI would like to be able to call a function from a movie clip so that the function repeats itself over a few different frames without having to be called again. I could have the function call itself according to an "if" statement but I believe that the movie will not go the next frame until it finishes all the cycles. So for example: The function makes the movieclip move over a few pixels but I want it to move over a bunch of pixels so as to give the illusion that it is moving slowly, I To do that the function needs to repeat until the movieclip moves the entire distance, but if that happens all within the function, at least as far as I have been able to figure out,
View 7 RepliesI am trying to repeat a function x number of times. How do I go about doing that?
Here is the function:
Code:
function dance(){
var animspeed = .4;
var back = 0;
var delay = (animspeed);
[Code]...
i'm using this code to for a button to make a MC "kids1" gradually scale to 300%, in 5% increments, but it only scales it 5% then stop, does anyone know how to make this function repeat until _yscale=300?
Code:
on (release) {
if (_root.kids1._yscale<300) {
_root.kids1._yscale+= +5;
}
}
how to run a function after 5 seconds.
All i'm trying to do is make some text dropdown after a set time.
Here's my code so far:
[Code].....
I'm trying to run a function for only three seconds, but cannot think of a solution. The timer seems to run after three second and not for three seconds.
View 1 RepliesI've tried using setInterval() but I just can't get it right... This is the function I want to execute every 5 seconds:
function next_(event:MouseEvent):void{
var sliderPos = sliderMC.x;
if(sliderPos != -696){[code3]..........
I have 2 functions going in as3:
function blueDownBounce (e:MouseEvent):void {
var blueDownY:Tween = new Tween(blue, "y", Regular.easeOut, -49, -19, 1, true);
}
blue.addEventListener(MouseEvent.MOUSE_OVER, blueDownBounce);
[code]....
I am trying to make it so that these functions are active after 3 seconds and they stay active for the whole time it is stopped on that frame after those 3 seconds. I know you have to make a timer and make it dependent on that timer but it wasn't working out well.
In the game I am building I need every 5 seconds a function to be called. The function looks like the following:[code]How would I go about making a time that pretty much counts to 5 and then resets itself again?
View 5 RepliesI trying to work out how to run a function after 5 seconds. All I'm trying to do is make some text dropdown after a set time.
Here's my code so far:
Code:
import fl.transitions.easing.*;
import fl.transitions.Tween;
var myText:TextField = new TextField();
var myFormat:TextFormat = new TextFormat();
var dropText:Tween;
var dropTextTimer:Timer = new Timer(5000, 2);
addChild(myText);
[Code] .....
At the moment the text drops down as soon as it loaded.
I have a movieClip that is basically a slide show.It is controlled by AS that is on its own timeline. It moves forward on its timeline, then a few frames later, I have it pause for 8 seconds with:
Actionscript Code:
stop();setTimeout (function() {play();}, 8000);
It then resumes playing and,a few more frames later,I have it jump to a different random slide. This all works fine. There are other frames on the MAIN timeline that do not contain this moveiClip. The problem is, if I go to one of those other frames in the main timeline, the above movieClip function is somehow still active, and after the 8 seconds it sends the play command. In this case, it causes the MAIN timeline to start playing.
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]....
How do you set a function to increment in AS3 Flash. I am trying to start the incremented function when my video starts and then run the same function every 20 seconds until the video stops.
[Code]...
OTHER items are started and set within this function that do not have to do with the incremented function.
How would I make a function last 10 seconds? For example, the function would stop after 10 seconds. I know you have to use timers, but can't quite figure out how to accomplish this.
View 9 Replieshere is my code
[Code]...
i want flash to refresh this function in every 1 seconds. how can i do that?
I need to call a function every number of seconds or so.. I'll just show some code:
Code:
image0.folder = "folder1/";
image1.folder = "folder2/";
[Code]....
basically, what it does is when i click, a block box (textholder), fades in, then after a few seconds (in this case, 2), it fades out again.. it works fine on the first click, but after more clicks, the interval duration seems to be getting smaller, up to a point where it is zero, and nothing happens.
and I need to use another setInterval() function (to call the changeTxt() function), will that affect the setInterval function i have up there now? i've linked an swf, to better show what i mean. [URL]
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].....
I had a function that occured on mouseclick called go_out. I want this function to occur when the timer fires after 5 seconds. After the 5 secons I receive this error:
[Code].....
I have eight images in a MC that I would like to sequentially fade in, display for a few seconds and fade out using _alpha function. So far I can fade one in with this AS:
img1._alpha=0
img1.onEnterFrame = function() {
this._alpha +=10;
}
Assuming my instances are img1, img2, img3, etc, etc... how would I go about sequentially fading each instance from 0 to 100, letting it display on the stage for a few seconds and then fade out (like a slideshow)?
I calling a function using setInterval()... however, it behaves differently in IE7 and Firefox. It is working fine in Firefox but not in IE7.Can I use getTimer() to call a specific function in every 3 seconds...?
View 1 RepliesThe below code displays time in hours:minutes:seconds format. This code works fine as long as backgroundcolor of the timetxt text field set to true. But as I want to set my own background for timetxt field, I have kept timetxt field's background as transparent. When it is transparent the seconds overlaps everytime when it is getting updated. It is fully dynamic. You can copy this code, paste in frame1 and test. But set your background as black as the font color is white.
ActionScript Code:
var today_date:Date = new Date();
var my_dtfmt:TextFormat = new TextFormat();
my_dtfmt.align = "center";
my_dtfmt.size = 20;
my_dtfmt.font = "Arial"
[Code] .....
how can i make a function example() be repeated 5 times with a delay of 3 seconds in between?
View 8 RepliesHow can I delay this function to happen 5 seconds AFTER I rolled my mouse over:
[AS]
on (rollOver) {
_root.mc_fotos.onEnterFrame = function() {
this._x -= ((this._x + 2800) / 4);
[Code].....
Is it possible for me to create a button that must be clicked 4 times within 3 seconds to call a function?
View 3 RepliesHow to stop Actionscript flow for few seconds like sleep function in other programing languages?[code]...
View 7 RepliesI have a movie which plays for several seconds, then I stop it. I want to resume it playing automatically after 10 secs.
View 3 Replies