IDE :: Create A Timer That Executes The Following Piece Of Code After 10 Seconds?
May 3, 2010How to i create a timer that executes the following peice of code after 10 seconds:
Code:
_visible = false;
How to i create a timer that executes the following peice of code after 10 seconds:
Code:
_visible = false;
I have an on(press) command that refreshes advertisements on an HTML page that my .swf is embedded in. When a user clicks on buttons that have the script, the advertisements refresh. I have a page that features a Slideshow Pro slideshow. Because this is a component, I am unable to put this script on the buttons in the slideshow. I am hoping instead, to have the script automatically run every 10-20 seconds. I am using actionscript 2.0 in a Flash CS3 file. Here is the code on the button:
[Code]....
I am new to flash. I can't seem to decifer the script examples in the help files. After a lot of trial and error the following codes works great. It delays playback on the video for the proper amount of time. The only problem is when the playback loops (like it should) the codes executes again. I only want to execute the code the first time thru.
[Code]...
Is there a way to create an if statement that executes two different loops?
For example, If I was trying to make game with a button that when clicked creates random objects falling down and when the objects are destroyed, creates random objects floating up. I haven't seen anything online, but I'm wondering if anyone know. Is it possible or should I just create two different listeners?
I am using AS2 and I am trying to make a simple 'game' for an assignment for school.I am first trying to make a simplified version of the game, to get some experience before I make the final version.
I will try to explain this simplified version:
The player has to drag an object in a big square and then release it. The object resamples 20 liter water. In total the player has to drag 100 liter water to the square, so it has to drag and drop the 'water' object 5 times.
I want some text in screen that says: You still need .
[Code]...
How to execute a piece of code once a on a frame For Example I want to execute this code only once..
/**********************
var rand:Number = (Math.random())%70;
gotoAndPlay(rand);
/**********************
If i have a piece o code that i would only like to tell Flash to use when a condtion is true how do i do that?Example of my code now:
aa = 1+Math.floor(Math.random()*5);
bb = 1+Math.floor(Math.random()*2);
if (aa == 1 && bb == 1) {
[code]......
I tried something interesting recently. I had code effecting an object with the instance name : object_mc.Now I added another object and gave it the same instance name.The result was, that the code only effected the most recent added object (no error).Is there a way in flash to have multiple objects with the same instance name all being affected by one piece of code?
View 5 RepliesWhe I use the code below in a template set up as a movie clip it appears and works fine but when i nvagate away from it the relative alignment code remains for the rest of the pages. Would use a remove child how would this look?
[Code]..
Im attempting to make a create your own art work style piece in flash. Ive designed it out so that you first select one of 3 buttons to select which vase you wish to use as a base. However the next set of buttons relate to the colour of that object, so there are 4 options (blue, red, pink and brown) and the user selects one from clicking the appropriate button.
However im strugling to figure out how i would know which of the first options (which vase) the user has selected in the first place. Is there some kind of time line trick or script that i could use to sort this out???
All I want to do is create a flashing box to highlight an important piece of text on screen.How can I create a simple rectangle that will flash say between blue/ green for a few seconds stop flashing and box still be visible. Its literally just to highoight some text on screen I need to make sure everyone reads.
View 3 RepliesI've got a problem that must be simple to solve but it seems beyond me, I'm new to AS3 so please be as explicit as you can in your explanation. I have a timer counting down from 60 seconds, what I want though is when the user clicks, ten seconds gets added to the time. I've tried many different ways but none work, I understand why they don't work but I can't think of a way that does.[code].....
View 4 Replies have a countdown timer counting down from 60 seconds. What I would like to happen is when the user clicks on the stage I would like the timer to increase by 10 seconds and then carry on counting down. e.g The user clicks when the timer is at 45 seconds so then the time jumps to 55 seconds and resumes counting down, whilst the time is displayed in a text box.
I asked in another forum and they pointed me to a link on adobe for the delay property. I gave this a go and I got it to add 10 seconds but then it kept on firing every 10 seconds (as you might expect) but not really what I was after.
here is the code for the timer.
Code:
var count:Number = 60;
var myTimer:Timer = new Timer(1000,count);
myTimer.addEventListener(TimerEvent.TIMER, countdown);
myTimer.start();
[Code]....
Im trying to reduce 5 seconds from the timer when the user clicks on the stage.This is the first time im using the Timer class and im not sure how to do this. This is the code i have so far,
Code:
var theTimer:Timer = new Timer(1000, 60);
theTimer.addEventListener(TimerEvent.TIMER, timerListen);
[code].....
I would really like just something simple and basic and easy to reuse on multiple timers.
I put in a number, lets say 350 (seconds) and the desired textfield displays: 05:50
I'm really no good at math, and most solutions I find I don't understand what's going on to simplify it for my use.
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]....
I am trying to make a timer that swaps two movie clips, so that each two seconds? Here is the code:
var leftPillar:MovieClip = new Right();
leftPillar.x=150;
leftPillar.y=250;
leftPillar.width=550;
leftPillar.height=400;
The idea is that each 2 seconds the movie clip should change to which ever one is now visible. What is currently happening is that only one of the clips ever shows, (newLeftPillar).
I have a timer and a dynamic textfield wich displays the time. Everytime my movieclip hits an enemy I want the timer to add 4 sec. to the current count. I would like to know why this isn't working:
timer.currentCount + 4;
(does nothing)
timer.currentCount += 4;
(error: property is read-only)
I am currently working on a new game and am wanting to know how to make a timer going up in minutes, seconds, and milliseconds. This is for AS2
View 2 RepliesThe following code for starting an event is quite okay. But how can I stop it after 10 seconds as it won't require anymore after 10 seconds of animation. I am using actionscript 3.
Code:
var timer:Timer = new Timer(1000, 1);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
[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 having a little trouble with the countdown tutorial here. I want to remove the milliseconds and have the timer based on seconds instead. How do I do that? I'm using Flash 8 if that means anything.
View 1 RepliesI need an Timer which starts counting on Buttonpress in secs:millisecs ... But independent from the Framerate (my movie has to run by 30 FPS)
View 1 RepliesI'm building a continous move in flash, and I'm displaying some text and images and want to hold the timeline for about 20 seconds and then resume play again. I'm trying to write a simple timer in AS to keep from having to create 10000 frame long movie clips. Here's what I have so far:
stop();
this.onEnterFrame {
time = getTimer();
if (time == 20) {
play();
}}
Unfortunately, this isn't working for me, and 'm unsure why. I suspect two things,
A: my "time" var takes only a snapshot value of the timer and not a continuous value, so the timer never reaches the value of 20. Or,
B: I have somesort of syntax wrong and the if never gets a chance to load.
Any tutorials or source files for the timer. Just a simple timer that counts down by minutes and seconds for 10 minutes. The closest I got are a bunch of codes that I'm not really good at translating. Just a simple timer that will trigger the end quiz page when time is up.
View 3 RepliesI notice on my 30 minute countdown timer that the seconds seem to skip and/or hesitate at different intervals. It seems to run for the full 30 minutes but it will be shown on a HUGE screen and the seconds movements is very obvious. how to fix the code for complete accuracy in the timing? Not sure if I should add milliseconds. ( I dont want that to show in the timer though, just minutes and seconds 00:00. Here's the code
[Code]....
i've given the variable as "countdown" When i press a button, i want to start count down 60 seconds, and when they passed go to the other frame (frame 2) and show my statistics.
View 4 RepliesI'm creating an online power hour application. And i need to have a timer to alert the user every sixty seconds for 60 minutes.. Should be simple enough. I'm just having some difficulty.
View 1 Replieshow to put a timer on a movieclip so that it appears and disappears after a certain amount of seconds
View 1 RepliesI am looking for a countdown timer what will countdown mins + seconds. All Ican find is a countdown to an event christmas day etc, but this wont work for what I need. I need a timer countdown that wont start again everytime a user enters the game I need a timer so all users enter the game at exactly the same time to the second, I've tried to do it using as3 php mysql but there is to much time difference between users how will I do this.
View 2 Replies