ActionScript 3.0 :: Make A Function Lasting 10 Seconds?
Nov 16, 2009
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.
I'm working on an autorun CD, and the first step that I tried to do was to publish the file I have. I've made a small index for a catelog I'm working on, and when disc is put in the persons computer, what is suposed to happen is a flash made index comes up with options to view catelog or exit or go to website etc. I just published the file, selected windows projector (exe) and published it. I found the file easily enough, but whenever I double click to open it, the screen for the index flashes once and then closes. I've never used Flash before, so I'm not sure why its doing this.
The only idea that I possibly have is that there is an issue with the timeline. I dont really know how to use timelines. The only thign that is supposed to really move in the index is a line of scrolling text at the top (which I edited within the actual animation itself so nothing shows up for duration on the main timeline, but the scrolling is supposed to last for 40 seconds). When I test it in Flash it works fine, the screen comes up, text scrolls over and over, and it stays open.
I'm on the last stage of developing my game, and I need to display a countdown timer, lasting 3 minutes. I want to display the time counting down in the format "3:00" and then when the timer hits the full 3 minutes an event is fired and it stops, and I display a few other things along with it in the same function. The difficulty I have is actually doing the bit where I display the timer and update it accordingly. If there is any genius out there who can do this (In AS3) then you are my new best friend. I only have a few hours till my submission deadline, and this thing is KILLING ME!!! hypothetically.
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.
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.
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?
I 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:
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.
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.
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]
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:
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:
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...?
I am trying to write a program in which 2 random pictures appear on the screen, and when you click on a specific one of the 2, the other disappears for 250 ms, and then the whole thing starts over with 2 new random pics. I have everything working the way I want EXCEPT for the vanishish-for-250-ms part.Specifically, the program is supposed to display 1 picture from 1 group and 1 from a 2nd group, and when you click on the pic from group 1, the group 2 pic is supposed to vanish for 250 ms. Each group has 16 pictures, so the code as it stands now basically randomly picks whether the group 1 pic will appear in movie clip #1 or #2 (faces1_mov and faces2_mov), randomly pics a group 1 pic, displays it in the movieclip it randomly chose, and then puts a random group 2 pic in the remaining movieclip, so the program has to know which clip has the group 2 pic in it and make it disappear when the other clip is clicked.Here is my code:
I'm making 8 input boxes with 8 different answers. Users can key in their answers in the input boxes. The order of the 8 answers will not affect their results. However when users get the wrong answers, the wrong answers will be deleted. My question here is, when the wrong answers are deleted automatically, how do i make the correct answers to appear by themselves after 5 seconds? Below is my code that i put on a "check answer" button.
on(release) { answers = new Array(8); answers[0] = "professional selling";[code].....
I want to make a circle rotate over 6 seconds. Does anyone know how to code this in AS 2.0 so that it happens over the 6 seconds. Basically I want the twelve oclock position on the circle will rotate all the way around back to the top over the 6 seconds.
I would like to know what the best way to implement the following feature is...
I have a popup dialogbox that comes up when the user clicks an object on stage...I want this popup to disappear or "close" if the user does not click the "close" button after 2 or 3 seconds...any takers?
I'm rather new to AS3 and have been tasked with a project, the project requires reading in values from an XML file created by PHP, this works fine if the XML file is available, and is just being updated by PHP, however, when flash calls the PHP page that creates the XML file for the first time, it doesn't give PHP enough time to make the XML file.
The 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] .....
I have an animation Logo flash movie which I want to appear after 10 seconds of loading the background image (Panel_mc)?
I am using Actionscript 3 to load the Logo.swf movie. The following is the whole code that I have on my action script page:
stop();import fl.transitions.Tween;import fl.transitions.easing.*; var PanelTween:Tween = new Tween(Panel_mc, "y", Elastic.easeOut, -400, 20, 5, true); var l:Loader=new Loader();addChild(l);l.load(new URLRequest("Logo.swf"));l.x = -20;l.y = -20; l.contentLoaderInfo.addEventListener(Event.INIT, growLoader); function growLoader(evt:Event):void { l.width = 320; l.height = 185;}
Note: I need it because first the background will animate so no one can pay attention to my Logo. Once the background stops animation, My logo needs to be start (animation)?