Welcome to WebmasterWorld Guest from 54.167.5.15

Forum Moderators: open

Message Too Old, No Replies

Get Flash Movie Duration

How to get the duration of the flash movies through javascript

     

pkonaje

2:43 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



I have a webapplication, where I have to display the total display duration of a Flash File. I am using Javascript to read the Flash file properties. Can anybody tell me how we can get Flash file properties like Total movie time in seconds, Flash file height and width in pixels?

Also is it possible to stop the movie after a single loop?

Thank you for your help.

Philarmon

1:04 am on Mar 9, 2005 (gmt 0)

10+ Year Member



I am assuming that you have already figured out how to pass data to JavaScript and you only need to figure that data out in the Flash movie.

The movie duration is stored in the getTime () object:

mytime = getTime ();

Note that the time is in milliseconds, so divide it by 1000 to get seconds:

mytime = getTime ()/1000;

You can get the width and height of the movie like this:

mywidth = Stage.width;
myheight = Stage.height;

Strangely Flash is missing 4 pixels on the width and height, so you have to add tehm up:

mywidth = Stage.width + 4;
myheight = Stage.height + 4;

And finally, to stop the movie at the end, make a keyframe on the last frame (F6) and place a stop () action there.

I hope that helps :)

pkonaje

3:05 am on Mar 9, 2005 (gmt 0)

10+ Year Member



Thank You... I will try this.

whoisgregg

6:18 am on Mar 11, 2005 (gmt 0)

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Thanks Philarmon for posting those helpful actionscript snippets. :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month