.swf Movie Timer/Timers Over 60 Seconds (My First Tutorial!)

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

.swf Movie Timer/Timers Over 60 Seconds (My First Tutorial!)

Postby JasonMc » Wed Aug 04, 2010 9:55 pm

EDIT: I've created a plugin, using this script as the base, and added quite a few extra features that allow for even more flexibility!
Get PocketWatch 1.0

--

Have you ever needed a timer that runs for more than 60 seconds? This can be especially important for playing longer .swf movies, since they have a nasty tendency to automatically loop.

Here is how to create a timer for any length of time. Just note, the two (very minor) limitations are that it will round your time to the nearest second, and that it is only designed for going to another frame. However, both could theoretically be overcome with tweaking.

I have this timer built so you can enter time in milliseconds, and it can be used multiple times in a project.

First, you will need to create two new global variant variables: "VidTime" and "VidAction"

Now, go into Procedures and paste this code. You don't have to change anything here.

Code: Select all
Sub VidTimer()
If VidTime>0 Then VidTime=VidTime-1000
If VidTime=<0 Then Action.GoToFrame VidTargetFrame
End Sub


Next, go to the Frame Properties of the frame where you want the timer (for example, where the .swf movie will play).

Under the "Advanced" tab, paste this code:

Code: Select all
VidTime = ###
VidTargetFrame = "TARGET_FRAME"
Action.CreateTimedEvent  1 , "VidTimer" , True


Replace the ### with the length of the video in milliseconds.

Replace "TARGET_FRAME" with the name of the target frame. Make sure there are quotes around the name.

Now, click "OK" and test your frame. After the specified length of time in milliseconds, the next frame will automatically appear.

NOTE: If you are using the Flash player, be sure to select "Remove All Open Flash Movies" under the "Plugins" tab on the target frame.
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA

Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron