Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Simple Timer


Hi.

I'm trying to devise a simple script that I can put on frame 1 that will 'gotoAndPlay(2)' after 5 seconds.


I know it has something to do with setInterval but after looking at about a dozen tutorials and all the Flash help material on the matter, I'm still completly unable to come up with a way to do this. It's irritating as well - every time I want to set up a timer like this I end up having to post on an ActionScript forum. I'll be sure to write the solution down somewhere this time around

Thanks.




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 11-11-2006, 10:22 PM


View Complete Forum Thread with Replies

Sponsored Links:

A Simple Timer
... any way to just start a simple timer? ...

View Replies !    View Related
A Simple Timer
K all I'm needing is a simple timer that counts hours, mins, and seconds since it was loaded... I checked the tutorials and I tried improvising with a timer_by_show off of a preloader...My desperation should intice you to help , thanks for the help in advance! The .fla file is attached.. its sloppy as of now but its my style~

View Replies !    View Related
Simple Timer
Why isn't this script working? I want it to run on the first frame until 30 seconds goes by and then move the head to the second frame. I'm rank and new to coding, so it's probably stupid.

var timeDemo:Number;
timeDemo = getTimer();
if(timeDemo > 30000){
gotoAndPlay(2);
} else {
gotoAndPlay(1)
}

View Replies !    View Related
Simple AS Driven Timer
hey dudes,

i just wanted to know if there is such
a thing as a "simple AS made timer"?

cause i would really like
to know how one is made


anyhoo, tnx a bunch!

View Replies !    View Related
Simple Countdown Timer
I just want to make a simple countdown timer, that everytime the flash movie hits the timers keyframe it counts down from 10 and then plays a sound. Is there a way to do this?

View Replies !    View Related
Creating A Simple Timer?
Hi,

I would like my movie to stop (this much I can do) on the first frame and then play frame 2 after 30 seconds. I basically want my movie to loop every 30 seconds. Can anyone help me with this?

Cheers,
Jen

View Replies !    View Related
Simple Timer Problems
Hi I'm using this simple timer function in a MC

stop();

function playAfter30(){
gotoAndPlay("b");
}

setInterval(playAfter30, 30000);

It works great,but is messing up the timeline of the main movie.Basically,if you hit a button and go to a marker in the timeline and bypass the location of the MC that has the timer,the play head will jump to another section as soon as that timer has done its thing.Confusing? Ya,I know..is there a way to use a timer in a MC that doesn't affect the main timeline?

Thanks

View Replies !    View Related
Simple Timer Ideas?
I'm trying to figure out how to make a simple 2 and 3-second timer using myButton and holdTimer. Here's the general idea:


===============
On myButton press:

reset holdTimer to 0
start holdTimer and let it count

On myButton release:

stop holdTimer

//Decision Time!!

if holdTimer >2 sec and <3 sec, gotoAndPlay ("Shorthold")

elseif holdtimer >3 sec, gotoAndPlay ("Longhold")

else gotoAndPlay the next frame

================

So if the user momentarily clicks myButton, flow simply goes to the next frame, but if user doesn't release myButton, flow goes to some other frame in some other timeline, depending on how long he holds the button.

This code will appear in every frame of a 100+ frame timeline ('cause I can't figger out a more efficient way to do it!)

I'm sure this can be done with only a few lines of code - nothing to display, no dates, etc.

Any suggestions are appreciated!!

Thanks in advance.

View Replies !    View Related
How To Create A Simple Timer?
Hi to all,

I'm a newbie, and I would like to know how is the easiest way to build a timer with hours, minutes, seconds, a start/stop button and a reset?

Thank you in advance,

Ricardo.

View Replies !    View Related
Simple Timer IF Statement
I'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:


Quote:




stop();

this.onEnterFrame {
time = getTimer();
if (time == 20) {
play();
}
}




Unfortunately, this isn't working for me, and i'm unsure why. I suspect two things, A: my "time" var takes only a snapshot value of the timer and not a continous 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. This seems like a relitively simple task, and i'm hoping one of you guys can shed some light.

Thanks!
--Isis.

View Replies !    View Related
Simple Timer Question
Hello,

I'm from Belgium (so excuse my english) and I'm a beginer in flash.

I've got a simple question for you :

I'd like to create a little script that goes to the next frame when 10 seconds have passed and I don't know how to do.

Please help me

xxx

View Replies !    View Related
Simple Timer Modification
I came across this timer from http://www.triquitips.com/flash_simple_timer.html and was wondering if anyone can assist in a little modification? I've emailed the publisher, but yet to receive a response yet.

Rather than the timer start from 00:00, I need it to start from 45:00 (45 being minutes).

Code:
startTime = getTimer();

onEnterFrame = function () {
elapsedTime = getTimer() - startTime;
elapsedHours = Math.floor(elapsedTime / 3600000);
remaining = elapsedTime - elapsedHours * 3600000;
elapsedM = Math.floor(remaining / 60000);
remaining = remaining - elapsedM * 60000;
elapsedS = Math.floor(remaining / 1000);
remaining = remaining - elapsedS * 1000;
elapsedH = Math.floor(remaining / 10);
if (elapsedHours < 10) {
hours = "0" + elapsedHours.toString();
}
else {
hours = elapsedHours.toString();
} // end if
if (elapsedM < 10) {
minutes = "0" + elapsedM.toString();
}
else {
minutes = elapsedM.toString();
} // end if
if (elapsedS < 10) {
seconds = "0" + elapsedS.toString();
}
else {
seconds = elapsedS.toString();
} // end if
if (elapsedH < 10) {
hundredths = "0" + elapsedH.toString();
}
else {
hundredths = elapsedH.toString();
} // end if
_root.timer_txt = hours + ":" + minutes + ":" + seconds + ":" + hundredths;

};Any help would be much appreciated.

View Replies !    View Related
Simple General Timer?
Hi, having spent many hours, with books and the web I'd like to ask for your help with a bit of code that wont run as I want it to.

The code is a simple Timer function, that works when I use it directly on the main timeline, but for the life of me I cannot get it to work as a class. I wish to have it as a standalone Timer class that I call when ever I want to have a delay (and ideally send it the delay). At the moment it wont even run with trace statements in the functions. The following is the code that works when on the main time line.

//start of Timer script

var delay:Number = 87;
var timer:Timer; // sets up a new Timer variable.

function myTimer()
{
timer = new Timer(delay, 10); // sets up a new Timer instance with a delay of 87 ms and how many repetitions (0 = continuous loop)

timer.addEventListener(TimerEvent.TIMER, onTimer); // adds a listener to the Timer and runs the function when the Timer starts

timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete); // this listens for when the Timer is complete (i.e. when the second number has been reached)

timer.start(); // this starts the timer running.

trace("inside timer");
}

function onTimer(event:TimerEvent):void
{
trace("tick");
}

function onTimerComplete(event:TimerEvent):void
{
trace("Finished!");
}

myTimer(); // runs the myTimer function'

// end of script

the above all works fine.

But when trying to use as a class it gives the following error.....

"TypeError: Error #1034: Type Coercion failed: cannot convert 87 to generalTimer. "

I have tried various types (Number, int, String) and it still says the samething.

Here's my class file....

// class file

package
{
//trace("called as file");
import flash.display.Sprite;
import flash.utils.*;
import flash.events.*;
public class generalTimer extends Sprite
{
//public static const w:Number = 10 * 1000;
public var timer:Timer;
trace("inside timer class");

public function generalTimer(w:Number)
{
timer = new Timer(w, 10);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
timer.start();
trace("inside timer");
}

private function onTimer(event:TimerEvent):void
{
trace("tick");
}

private function onTimerComplete(event:TimerEvent):void
{
trace("Finished!");
}
}
}

// end of class file

In the .fla file i have the following....

// start of .fla file
var w:Number = 87;
generalTimer(w);
// end of .fla file

why cant I send it a number to act on as it does inside my .fla file or like arguments sent to a function?


Also even when testing it with the code as a standalone class as follows, it doesn't do anything?

//
public class generalTimer extends Sprite
{
public static const w:Number = 10 * 1000;
public var timer:Timer;
trace("inside timer class");

public function generalTimer()
{
timer = new Timer(w, 10);
//


I've tried 'generalTimer;' which doesn't do anything. I've tried 'generalTimer();' which gives me 'too many arguments' error.

Im eventually looking to have it return something(not sure yet) when the 'onTimerComplete' event happens too, but that'll be my next problem.

Please help as all logic has gone out the window it seems.

Thanks in advance.

Trev.

View Replies !    View Related
Simple Timer Control?
hi all!
i'm looking for a script that tells the timeline to start to play frame 25, after 5 seconds.

i've found a few codes online but cos they are for different purposes, i just cant seem to custom it to work accordingly.

can someone pls help? ps: i'm using Flash 8

much appreciated!

View Replies !    View Related
Simple Timer IF Statement
I'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:


Quote:




stop();

this.onEnterFrame {
time = getTimer();
if (time == 20) {
play();
}
}




Unfortunately, this isn't working for me, and i'm unsure why. I suspect two things, A: my "time" var takes only a snapshot value of the timer and not a continous 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. This seems like a relitively simple task, and i'm hoping one of you guys can shed some light.

Thanks!
--Isis.

View Replies !    View Related
Simple Timer Countdown Script Help
In my car game, I want a timer to count down from 8 seconds, but I want it to have Milliseconds in it also.

So I have a seperate variable for the seconds, and one for the Milliseconds in the MC "Timer"

On the keyframe of the timer i have this code:


Code:
stop ();
go = 1;
_root.timer.seconds = 8;
_root.timer.milliseconds = 60;


I have these actions on the MC "Timer"


Code:
onClipEvent (enterFrame) {
millidisplay == milliseconds;
if (_root.go == 1) {
milliseconds -= 1;
}
if (milliseconds == 60) {
millidisplay == 0;
}
if (milliseconds == 59) {
millidisplay == 59;
}
if (milliseconds == 0) {
milliseconds == 60;
seconds-1;
}
if (String(seconds).length == 1) {
seconds = "0"+seconds;
}
if (String(milliseconds).length == 1) {
millidisplay = "0"+millidisplay;
}
////This is irrelevant to the timer script
if (seconds == 0 && milliseconds == 0) {
stopAllSounds ();
gotoAndStop ("training");
tellTarget ("_root.cursor") {
gotoAndStop (1);
}
tellTarget ("_root.trainingcaption") {
gotoAndStop (2);
}
tellTarget ("_root.trainingpicture") {
gotoAndStop (2);
}
}
}
(Millidisplay is the actual what the player will see for the milliseconds part of the timer. It was my attempt to get the script to work, but you can just use milliseconds if you have modifications to the script.)

Thanks a million!

View Replies !    View Related
How To Make A Simple Countdown Timer
i need help with a game i am making. I want it so that when the scene starts (in this case scene 2 contains the game) and it starts counting down from 59 - 0 in seconds (1 min) and when the countdown has finished, i want the movie to proceed onto the next frame.

thank or the help

View Replies !    View Related
How To Make A Simple Countdown Timer
i need help with a game i am making. I want it so that when the scene starts (in this case scene 2 contains the game) and it starts counting down from 59 - 0 in seconds (1 min) and when the countdown has finished, i want the movie to proceed onto the next frame.

View Replies !    View Related
Simple Preloader Timer I Can't Get To Work
Hello, i'm just working on a simple preloader and i can't get my timer or my load bar to work properly. There's a bug or two in the script somewhere. I've gotten all the other elements in it to work except those two. I'll list the code here but i'll also include the file because thats probably the best way to see what i'm talking about. Thankyou very much to anyone who can help.

Here's the code:

Frame 1 -

this.onLoad = function() {
//StartTime = getTimer();
StartTime = getTimer();
};//starts a timer that gets how long the movie has currently been playing in milliseconds.
total_kb = int (_root.getBytesTotal()/1024);//calculates movie's total size in kb using built in function.
loaded_kb = int (_root.getBytesLoaded()/1024);//calculates movie's loaded amount in kb using built in function.
//next line checks to see if loaded kb is smaller than total kb, i.e. still loading.
this.onEnterFrame = function() {
if (loaded_kb < total_kb)
{
remaining_kb = total_kb - loaded_kb;//subtracts loaded kb's from total kb giving remaining kb.
percent_loaded = (loaded_kb/total_kb)*100;//finds out percent loaded by extracting information from loaded kb and total kb.
percent_loaded_text = Math.floor(percent_loaded) + "%";//rounds down number to nearest integer.


dl_speed = loaded_kb / ((getTimer() - StartTime) / 1000);//converts time between starting and this point to seconds and finds an average download speed.
remaining_time = Math.floor(remaining_kb/dl_speed); //calculates an exact remaining time judging by average download speed.
loadBar._xscale = percent_loaded;//scales the load bar to a percent value equal to the percent loaded.
trace (StartTime);
}
else
{
_root.play();
this.onEnterFrame = null;
}
};

Frame 2 -

gotoAndPlay(1);

View Replies !    View Related
Help With Simple Timer Controlled Function
Hey there,

I'm trying to detect if the user has not moved the mouse in my flash menu for 5 seconds, and if so, reset the menu. I stumbled upon the following:
http://livedocs.macromedia.com/labs/...=00000075.html

(note the corrected code in the comments...)

... and this is as far as I've gotten. Any help would be greatly appreciated!


Code:
navReset = function () { /* I'm ok with this part - just need to write it */ }

var minuteTimer:Timer = new Timer(1000, 5);
minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, navReset());
minuteTimer.start();

onMouseMove = function() { minuteTimer.start();} // will this even restart the timer ?

View Replies !    View Related
Newbie Needs Help With A Simple Timer Script
Please help this newbie out.

I am trying to script a simple 3 second timer. Everything works fine except the jump. Can someone please check my code and tell me why it fails to jump to "new".

frame 86 label "wait"
frame 100 label "new"

script on frame 85:
starttime = getTimer();

script on frame 89:
g = getTimer();
timepassed = g - starttime;
if (timepassed >= 3003) {
gotoAndPlay("new");
};
gotoAndPlay("wait");

TIA

View Replies !    View Related
How To Create A Simple Preloader Timer Script?
onClipEvent (load) {
tkb = Math.round(_root.getBytesTotal()/1000);
_root.totalkb = ("kb of " add tkb add "kb loaded");
}
onClipEvent (enterFrame) {
kb = Math.round(_root.getBytesLoaded()/1000);
kbleft = tkb-kb;
_root.kbloaded = kbleft;
if (kb == tkb) {
_root.nextFrame();
}
}


I want to add a simple timer that countdowns the amount of time left for the file to load.

like this:

LOADING
398 of 3000 kb loaded
0:00:18 <--------------- hmm?

View Replies !    View Related
Simple Timer, After 15 Secs, Gotoandplay Next Frame
I thought I was getting ok with flash but cannot solve this one.

Im trying to make a timer (none visual).

So after being on a key frame for 15 seconds it goes and plays the next keyframe.

I know the script is really simple but I gave up at 3am

any code or links would be kind, thank you.

View Replies !    View Related
Timer Events - Simple Way To Pause Action?
I'm working with a couple of simple transition effects in a banner. I want it to do nothing for 10 seconds and then start my TransitionManager.

Do I need a timer event? Or there's a more simple way to pause/stop all operations at the beginning of my code?

View Replies !    View Related
Difference Between Timer.stop() And Timer.reset()?
Hello,

What is the difference between Timer.stop() and Timer.reset() functions because it seems that the 2 functions do the same thing? I image Timer.stop() to stop the timer and when Timer.start() is called the timer starts from where it stopped. For example, if I have a 3 sec. timer (3000 ms). If I stop the timer after 2.5 sec. and start the timer again, I would expect the timer to expire/trip within .5 sec. Is this a correct assumption?

Thanks,

Nilang

View Replies !    View Related
Difference Between Timer.stop() And Timer.reset()?
Hello,

What is the difference between Timer.stop() and Timer.reset() functions because it seems that the 2 functions do the same thing? I image Timer.stop() to stop the timer and when Timer.start() is called the timer starts from where it stopped. For example, if I have a 3 sec. timer (3000 ms). If I stop the timer after 2.5 sec. and start the timer again, I would expect the timer to expire/trip within .5 sec. Is this a correct assumption? Code is attached below.

Thanks,

Nilang







Attach Code

// Declarations
var url:URLRequest;// Url
var snd:Sound;// Sound Object
var sndChan:SoundChannel;// Sound Channel Object
var sndPosition:Number;// File offset
var tmr:Timer;// Timer object
var isPlaying:Boolean;// Flag to indicate whether file is
// playing or not
var isPlayDelayed:Boolean;// Flag to indicate whether starting
// of file has been delayed or not

var hours:Number = 0;// Hours
var minutes:Number = 0;// Minutes
var seconds:Number = 0;// Seconds
var milli:Number = 0;// Milliseconds

var pauseTime:Number = 0;// Time when paused
var pauseLength:Number = 0;// Length of pause
var buttonPressTime:Number = 0;//

var timing:Boolean = false;// Flag

// Initialize variables.
isPlaying = false;
isPlayDelayed = true;
sndPosition = 0;

// Get url
url = new URLRequest("sound1.mp3");

// Create new Sound object
snd = new Sound();

// Create new SoundChannel Object
sndChan = new SoundChannel();

// Create a new Timer Object with timeout of 5 sec.
// and repeat it only once.
tmr = new Timer(5000, 1);

// Load the audio file
snd.load(url);

// Enable Event Listeners
tmr.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
stop_btn.addEventListener(MouseEvent.CLICK, onStop);
pause_btn.addEventListener(MouseEvent.CLICK, onPause);
play_btn.addEventListener(MouseEvent.CLICK, onPlay);
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);

// Start time
pauseElapsedTime(false);

// Start Timer
tmr.start();

// Function that handles timer events
function onTimerComplete(e:TimerEvent):void
{
// Play audio file when timer complete event is received
sndChan = snd.play(sndPosition);

// Set the isPlaying to true to indicate file is playing
isPlaying = true;

// Set the isPlayDelayed to false
isPlayDelayed = false;

trace("onTimerComplete: " + e);
trace("target: " + e.target);
trace("current target: " + e.currentTarget);
}

// Function that captures frame events
function onEnterFrameHandler(e:Event):void
{
// Local variables
var totalTime:Number = (getTimer()/1000)-pauseLength;
var goTime:Number = totalTime-buttonPressTime;

// If flag is true, then calculate the time that has elapsed
if( timing )
{
// Calculate time
hours = Math.floor(goTime/3600);
minutes = Math.floor((goTime/3600-hours)*60);
seconds = Math.floor(((goTime/3600-hours)*60-minutes)*60);
milli = Math.floor((goTime-(seconds+(minutes*60)+(hours*3600)))*100);

// Display elapsed time
timeText.text = format(hours) + ":" + format(minutes) + ":" + format(seconds) + "." + format(milli);
}
}

// Function that captures mouse click events when user clicks stop button
function onStop(me:MouseEvent):void
{
// Reset time
restartElapsedTime();

if (isPlaying)
{
// If audio file is playing then stop the audio file, set file offset to zero,
// and set isPlaying flag to false
sndChan.stop();
sndPosition = 0;
isPlaying = false;
isPlayDelayed = true;
}
else if (isPlayDelayed)
{
// If audio playback is delayed then reset the timer and
// set isPlaying to false
tmr.reset();
isPlaying = false;
}
}

// Function that captures mouse click events when user clicks pause button
function onPause(me:MouseEvent):void
{
// Pause time
pauseElapsedTime(true);

if (isPlaying)
{
// If audio file is playing then stop the audio file,
// set file offset to current offset, and set isPlaying flag to false
sndChan.stop();
sndPosition = sndChan.position;
isPlaying = false;
}
else if (isPlayDelayed)
{
// If audio playback is delayed then stop the timer and
// set isPlaying to false
tmr.stop();
isPlaying = false;
}
}

// Function that captures mouse click events when user clicks play button
function onPlay(me:MouseEvent):void
{
// Start time
pauseElapsedTime(false);

if (!isPlaying)
{
if (!isPlayDelayed)
{
// If the audio file is not playing and playback is not delayed, then
// play the audio file from the last offset and set isPlaying to true
sndChan = snd.play(sndPosition);
isPlaying = true;
}
else
{
// If the audio file is not playing and playback is delayed, then
// start the timer and set isPlaying to false
tmr.start();
isPlaying = false;
}
}
}

// Function that sets the time to 00:00:00.00 (default)
function restartElapsedTime():void
{
timeText.text = "00:00:00.00";
buttonPressTime = (getTimer()/1000)-pauseLength;
pauseElapsedTime(true);
}

// Function that pauses time
function pauseElapsedTime(b:Boolean):void
{
if( b )
{
pauseTime = getTimer()/1000;
}
else
{
pauseLength = ((getTimer()/1000)-pauseTime)+pauseLength;
}
timing = !b;
}

// Function adds 0 to the front of the number when it is < 10 and
// returns a String
function format(n:Number):String
{
if( n < 10 )
{
return ("0"+n);
}
return n.toString();
}

View Replies !    View Related
Timer - Not Timer Class, But Time Taken To Do Certain Events
So i'm making a little game and want to know how to start a timer and display the number of milliseconds between the start and finish of two different events. I do not want to run a function after 5000 milliseconds or whatever, just record the length of time taken to say click two buttons.

Basically a stopwatch.

I saw the getTimer(); function but i'm not sure of how to use it or if that is what i need.

Once again, thanks for your time.

View Replies !    View Related
Running Timer And Timer With Offset
Hello all,

I'm trying to set up two timers in that dare feed the time in minutes and seconds from the server.

Basically, I've got a master running timer in seconds and minutes but also want to have a second cloned timer that is feed some seconds via flashVars to add to the the master time.

Both of these timers once set by the sever time feed in, and with one being offset, are called every second by a setInterval function call so they count up.

Setting up the master running timer isn't a problem but with my coding skills is a little messy..


Code:
_global.masterRunningTimeInMinutes = 59;
_global.masterRunningTimeInSeconds = 55;

if (_global.masterRunningTimeInSeconds>0 && _global.masterRunningTimeInSeconds<59) {
_global.masterRunningTimeInSeconds++;
} else {
_global.masterRunningTimeInSeconds = 0;
_global.masterRunningTimeInSeconds++;
if (_global.masterRunningTimeInMinutes>=0 && _global.masterRunningTimeInMinutes<=58) {
_global.masterRunningTimeInMinutes++;
} else if (_global.masterRunningTimeInMinutes>=59 && _global.masterRunningTimeInSeconds>=0) {
_global.masterRunningTimeInMinutes = 0;
}
}
if (_global.masterRunningTimeInSeconds<10) {
_global.masterRunningTimeInSeconds = "0"+_global.masterRunningTimeInSeconds;
}

_root.runningTime.text = "v"+_global.masterRunningTimeInMinutes+":"+_global.masterRunningTimeInSeconds;
Ideally I wanted to to get the master running time to display MM:SS so if anyone can help with that that would be great!

I suppose the real problem I'm having is is setting up the pattern for determining the cloned time with the offset.

This is becoming a real headache but if anyone can help I would really appreciate it! Basically I just wanted to have the running time with the cloned time always a certain amount of seconds ahead.

Many thanks, amp3

View Replies !    View Related
LoadMovie SIMPLE Question For Simple Minded Graphic Artist
OK! So this will be EASY EASY for all of you.

I need to load a seperate SWF file onto the stage on a level above the main swf.

the seperate SWF file is in the same folder as the original all located in the "flash" folder of the root directory.

How do I get th e outside SWF to load on top of the movie.

The original movie is called grid.swf the outside movie is called liquid-print.swf

If anyone can help me with giving me the code I'd appreciate it. I really am quite dense when it comes to coding.

View Replies !    View Related
Can You Help Me Fix Simple Javascript Code On Button Inside My Very Simple Component?
Flash MX 2004 (mac)
******************

Hi,

I have a custom component that consists of nothing more than two dynamic text feilds and a button. I want the button to open a popup window in the browser, and it does so using javascript (an extension i found).

I put the following function in the first (and only) frame of my actual component (and its also in the first frame of my entire movie, just in case):

callPopup = function() {
getURL(popup);
};


And then on the button in my component i have this:

on(press){
callPopup();
}

and then finally,there is a variable named 'popup' within my component (which would change in each instance) which is given a value in my test instance as :

"javascript:jspw3('../vwd_scripts/','popups/acroyoga.swf',',,0,Past%20Event,index,Past%20Event ,20,0,,0,450,550,0,0.001,0.001,,,1,0,,.0.0.');"


somewhere i am doing something wrong.. ..i am not sure if its the button code, or my link (variable 'popup') syntax. Or if its impossible to use javascript in this way.

I know my html page is set up correctly (correct info in the head of the page etc), since i am able to call the javascript from a regular html link (just for testings sake) which is on the same page as my swf.

Hmm..i hope i made some sense here.

I will be very gratefull for some help...i'm totally lost on this one...

thanks in advance

Cheska

View Replies !    View Related
[F8] Very Simple Question, Very Simple Answer, I Hope. (Flash 8, Collisions)
Alright, so I've got my ball that moves up and down; it has gravity too. There are two things I want to do:

1. I want it to 'jump' when the UP key is pressed, rather than just accumulatively move upward.

2. I only want gravity to be applied while the ball is in the air(In other words, I basically just don't want it falling through the floor; however, want the edges to be the collision, not the center, and I also still want to be able to jump afterwards.

Thanks for any help, I don't need an explanation, I can figure it out by looking at the code. I'm going to attach a basic file with what I already have, please add the coding to it, then send the file back. Thanks for any help, and I apologise if this is hard to understand, or if I sound any bit rude to be asking how to do something; I don't mean to.

View Replies !    View Related
Can You Help Me Fix Simple Javascript Code On Button Inside My Very Simple Component?
Flash MX 2004 (mac)

Hi,

I have a custom component that consists of nothing more than two dynamic text feilds and a button. I want the button to open a popup window in the browser, and it does so using javascript (an extension i found).

I put the following function in the first (and only) frame of my actual component (and its also in the first frame of my entire movie, just in case):

callPopup = function() {
getURL(popup);
};


And then on the button in my component i have this:

on(press){
callPopup();
}

and then finally,there is a variable named 'popup' within my component (which would change in each instance) which is given a value in my test instance as :

"javascript:jspw3('../vwd_scripts/','popups/acroyoga.swf',',,0,Past%20Event,index,Past%20Event ,20,0,,0,450,550,0,0.001,0.001,,,1,0,,.0.0.');"


somewhere i am doing something wrong.. ..i am not sure if its the button code, or my link (variable 'popup') syntax. Or if its impossible to use javascript in this way.

I know my html page is set up correctly (correct info in the head of the page etc), since i am able to call the javascript from a regular html link (just for testings sake) which is on the same page as my swf.

Hmm..i hope i made some sense here.

I will be very gratefull for some help...i'm totally lost on this one...

thanks in advance

Cheska

View Replies !    View Related
Simple Problem. Simple Answer? Arranging Windows W/flash
SIMPLE problem. | SIMPLE answer?
We're trying to have a Full screen CD presentation in flash that plays .avi's in windows media player, & opens up url's in a web-browser. The problem is the URLs AND the .AVIs show up underneath the flash, is there a way to have them open on top of the presentation?

Thank you.

View Replies !    View Related
Random Tweens - Simple Question, Simple Answer?
Hello, I have one swf with a few different motion tweens inside their own movie clips. I want to write some code to play only one of the tweens at random. I know how to use setInterval to get the process to repeat with a delay. But I just want a different/random tween to play with each repeat. I hope that makes sense.

I imagine this must be easy, but I'm having a tough time getting it to work. Random tweens, somebody please help.

View Replies !    View Related
HELP SIMPLE, SIMPLE XML-FLASH Load Into Movie Clip
This is so stupid, my first dive into XML, with a company project - a tutorial/training piece which will require mjultiple screens with questions, etc.

Anwyay- I can get the XML loaded into the root, and it works pefectly, but I'd like to put things INTO a movie clip, so that each new screen or slide is just he movie clip advancing.

How the HELL do I target the movie clip? I even tried setting a NEW variable in teh main timeline once the XML was loaded, but the best I get is not the value from the XML, but the path (e.g. "level0title1")

Any help? I imagine it's a really stupid, easy question, but I can't find anythign ANYWHERE to answer it.

View Replies !    View Related
Timer.
Hi, I am having problems with a timer.

Using the code from one of the movies here on Flashkit, I wanted to add 100th seconds to the movie. Here's the code:

millitime = getTimer()/60000-(int(getTimer()/60000));
seconds = (int(millitime*60));
milli = (int(millitime*6000));
mymin = (int(getTimer()/60000));
if (seconds <10) {
seconds = "0" + seconds;
}
if (Number(mymin)<1) {
mintime = "00";
} else {
mintime = (int(getTimer()/60000));
if (Number(mymin)<10) {
mintime = "0" + mintime;
}
}
minfield = mintime;



As you can see 'milli' is the amount of milliseconds in a minute, and I am unsure as to how to get this to read 00 - 99 in a single field and then restart after 1 second. HELP?

G

View Replies !    View Related
Timer
Let's say I have this timer:

timer = int ((getTimer ())/60000)


When I go to the next frame/stage I want the timer to "reboot". So I thought, why not do this:

timer = int ((getTimer ())/60000)

timer2 = int ((getTimer ())/60000)


And in the next frame/stage:

timer = int ((getTimer ())/60000 - timer2)


But all I get is the same value. At first I thought that If a put a, for example, getTimer value in a var, then it remains constant, keep the same value that the timer had in that specific time. And therefor should my script work, but it doesn't. Why?

View Replies !    View Related
Timer
Hello, i have a question.

How can i insert a visible countdownb timer (20 seconds) in my flash movie and when the timer = 0 i want a certain script to be executed????

sorry for my bad English

View Replies !    View Related
Help With Timer
Hi,

I have posted this problem before but I still can't fix it.

problem:
I want a clock in milliseconds to start on a specific frame and end it on another.
With getTimer() I can't get the clock to start on a frame. It always starts on frame 1 of the main timeline.

PLZ does anyone know a solution ?

View Replies !    View Related
Timer
How do you make a timer so that I can set a number of seconds before going to the next frame?

Thanks

View Replies !    View Related
Set A Timer
is there a way to tell a movieclip wait 10 seconds and then goto a certain frame number and play.

Like you just want the moieclip to wait 10 seconds before it restarts.

View Replies !    View Related
Timer
How could I program a timer to count down from 3 and then go to the next frame?
I'm sure it's simple, but I can't program for crap

View Replies !    View Related
Timer
I have 5 questions in my flash.
I'd like to create a timer that counts how long it takes to answer. How could I do that?

View Replies !    View Related
How To Set The Timer
well i have got a sort of a traffic light and i want each light to be displayed exactly after 4 secs. how do i write a code to do it ??can anyone plz help me ????

View Replies !    View Related
Timer
Im using this code to time 30 seconds I know its wrong and would really appreciate help
In the first frame i have

startTime = getTimer ();

then the next

newTime = getTimer();
if ((newTime/1000)-(startTime/1000)>30) {
_root.gotoAndPlay("10");
} else {
gotoAndPlay (2);
}
_root.showTime = (newTime/1000)-(startTime/1000);

View Replies !    View Related
Timer
Hi there!

How do I stop in a frame lets say in 5 sec. and then gotoAndPlay the next frame?

Thanx
SAM

View Replies !    View Related
Timer
hi.

i want this function to repeat itself only every two seconds. how do i do that? a "do while" loop using getTimer?

function playBack (note) {
for (i=0; i<musicList.length; i++) {
fscommand ("player1.playNote", musicList[i]);
}

i'm pushing a bunch of notes to an array, and then i want them played back, but i want a little space between them, so they don't play back all at once (which is what they're doing now).

View Replies !    View Related
GET TIMER HELP
can someone tell me what the "gettimer" code is and how it is used. And an example would help too.


Thank!

View Replies !    View Related
HELP WITH TIMER PLEASE
I am trying to make a timer that displays the elapsed time of a music track.

I need something that can divide _root.totalframes by _root.currentframe and then multiplies that percentage by the total length of the main timeline (where the sound is) and comes up with something formatted in minutes and seconds.

it must be constantly updating based on currentframe/totalframes because the user can jump to any point on the timeline (or any point in the song) whenever he/she wishes.

see what I'm saying?

View Replies !    View Related
GET Timer
Hi I need to know how to use this actionscript, any ideas on tutorials

View Replies !    View Related
Get Timer (help)
onClipEvent (enterFrame) {
wait = 2;
starTimer = true;
if (starTimer) {
if (startTime == undefined) {
startTime = getTimer()/1000;
}
curTime = getTimer()/1000;
if ((curTime-startTime)>=wait) {
starTimer = false;
delete startTime;
// actions to do after time is up
_root.any.play();
_parent.removeMovieClip("newcode");
} else {
_root.timeRemaining = wait-(curTime-startTime);
}
}
}


Hey guys,

here above i've a timer script, which after every 2 secs play a movie clip. the script is perfectly functioning properly. the only problem it has, it goes into the loop. what i mean, after every two secs, it plays the mc. though using the attachmovie method, i can remove it after the first two secs. but can i modify the script, not using the attach movie method, so that it plays only once, i.e only after two secs & then terminated.

also, the above script fails to run, if given onClipEvent(load). can i know the reason why.
please help, guys!.

ravi.tandon@learningmate.com

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved