ActionScript 3.0 :: Run Function For 3 Seconds?
Jun 27, 2010I'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'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 Replieshow 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 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'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.
I jst wonder if I could make the object "car" to repeat doing this:
ActionScript Code:
function start_car(){
_root.car.onEnterFrame = function(){
[code].....
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 RepliesI'm getting a data which contains a certain number.
I need to find how many hours, minutes and seconds it stands for.
for example:
I'm getting the number 248 which means:
00 hours : 04 minutes : 08 seconds
When i use time varaible and then minus the time. Ive noticed that flash does not count down in seconds, but the speed of light. My maths are not very strong so how can i get flash to count in seconds
var time =60;
sprite.onEnterframe = function(){
time -=1; ( this counts faster than seconds)
}
I'm trying to figure out how I can make the sound file that I load into Flash start at x seconds and end at x+30 seconds.So basically, I just want a 30 second sample to play starting at a specific time position. Does anyone have any advice on how to do this or have links to somewhere I can read up on it?
View 4 RepliesI'm working with the youtube API and I'm getting the current time on the video as seconds.What I want to do is to convert them into this: MM:SS.I've tried to google and try different things by myself but nothing seemed to work and be efficient.
View 4 RepliesI am currently using the following code to display the secconds of a FLV being played:
ActionScript Code:time_txt.text = Math.round(_root.video_mc.videoZ.playheadTime*100)/100;I need to change this to display MM:SS (minutes:seconds) rather than just seconds and decimals.The javascript people here at work suggested something like this:
ActionScript Code:
function strPad(str, places, pad, side) {
while (length(str) < places) {
[code].....
I'm having some trouble getting the following code to work - trying to use the new Sound.extract() function to get two seconds of a Sound into a ByteArray, and then create a new bytearray with a WAV header, and then output the file. The resulting 'test.wav' file sounds very wrong although slightly recognisable? I think I may have some of the WAV header settings may be wrong but I'm not quite sure what's the matter and after a long time scratching
[Code]...