
571
ADOBE GOLIVE CS2
User Guide
Custom functions in QuickTime scripts
QuickTime Wired Action Programming Language lets you create true custom functions, complete with custom
arguments and result values. For example, the following uses a custom function called “my Add Func” to add two
values and return the sum:
f u n c t i o n o n M o u s e D o w n ( )
{
v a r t h e R e s u l t = m y Ad d F u n c ( 1 0 + 2 0 ) ;
d e b u s S t r i n g ( t h e R e s u l t ) ;
}
f u n c t i o n my Ad d Fu n c ( v a l u e 1 , v a l u e 2 )
{
r e t u r n ( v a l u e 1 + v a l u e 2 ) ;
}
Combining eventhandler actions in one script
You can combine multiple eventhandler scripts into one script file, depending on the track type.
Note:
When you use an eventhandler in a script, do not use the matching predefined action, as it will be overwritten by
the eventhandler in the script.
Sprite tracks
You can combine onIdle, onListReceived, onKey, onMouseMoved, onMouseDown, onMouseUp,
onMouseClick, onMouseEnter, and onMouseExit eventhandlers in one script. OnFrameLoaded requires a separate
script file.
Text tracks
You can combine onMouseDown, onMouseUp, onMouseClick, onMouseEnter, and onMouseExit
eventhandlers in one script file. OnIdle, onListReceived, onKey, and onMouseMoved each require a separate script.
Movie Tracks
Only onMovieLoaded is allowed as an event handler.
SWF tracks
You can combine onMouseDown, onMouseUp, onMouseClick, onMouseEnter, and onMouseExit.
Variable scopes
QuickTime supports variable scopes, which indicate where and when a variable can be used within a movie. There
are four variable scopes.
Note:
Text, movie, and Flash tracks can use only movie variables. When you add a script to these types of tracks, GoLive
generates the required movie variables automatically.
Movie variables
Movie variables are accessible from all scripts and objects for the length of the movie. Movie
variables must have the prefix “m_”. For example,
“var m_Counter = 10;”
defines a movie variable.
Global variables
Global variables are only allowed for sprite tracks. They can be accessed by all sprites on a track.
Global variables must have the prefix “g_”.
Sprite variables
Sprite variables, while allowed only for sprites, are accessible from different eventhandlers. Sprite
variables must have the prefix “s_”.
Local variables
Local variables are only allowed for sprites and sprite track actions. They do not require a prefix.
Summary of Contents for GOLIVE CS2
Page 1: ...Chapter 1 Copyright User Guide...
Page 251: ...ADOBE GOLIVE CS2 242 User Guide...