ASPNetFlash JavaScript API
The ASPNetFlash JavaScript API allows
your to control the client bahvior of Flash Movies . This API does
not require ActionSpeak™ to be installed.
Please note that order of JavaScript code within the web page is important. ASP.Net includes all JavaScript libraries in the <body> after the main form tag. We suggest that you add your JavaScript API code towards the bottom of your HTML code. If you wish to place JavaScript API commands in the <head> tag - you must call them on or after the window.onload event.
The API can be accessed by using the accessor function
below:
Accessor function
ASPNetMedia.Flash(id)
|
Returns an object allowing you to use the
JavaScript API methods to control a ASPNetFlash Flash
Movie.
e.g.: ASPNetMedia.Flash("Flash1") ; |
JavaScript API
To use the API functions, you must call them using the object returned by the
Accessor function.
e.g.: ASPNetMedia.Flash("Flash1").GotoAndPlay(10);
Getting and Setting ActionScript Variables
| SetFlashVariable (expression,value) |
Sets the value of any variable or property in the target Flash Movie. |
| GetFlashVariable (expression,value) |
Returns the value of any variable or property in the target Flash Movie. |
Manipulating the Flash Object
Float(style)
|
Causes the Flash Movie to float above other objects on the web page in a movable, transparent layer.
Possible values of style are:
absolute - MoveTo uses absolute coordinates.
The page collapses to fill the empty space.
relative - MoveTo uses relative coordinates
which may be negative.
none - Ends
the Float behavior. |
| MoveTo(x,y) |
Moves the floating Flash Movie to the specified coordinates.
x and y can be defined in "px"(default) or "%". |
| ResizeTo (width, height) |
Resizes the Flash movie in the HTML. width and height can be defined in pixels(default) or percentages. |
| LoadSWF(url) |
Loads a new SWF, replacing the existing content. The url is relative to the ASPX page, and cannot contain the tilde ("~/") expression. |
PlayBack Control
| GotoAndPlay(frame) |
Moves the Flash timeline to a numbered or named frame, and plays from that point. |
| GotoAndStop(frame) |
Moves the Flash timeline to a numbered or named frame, and stops() |
| NextFrame() |
Moves the Flash timeline forward 1 frame. |
| PrevFrame() |
Moves the Flash timeline back 1 frame. |
| Play() |
Makes the flash movie's main timline. |
| Stop() |
Stops the flash movie's main timline . |
Calling Flash ActionScript functions with JavaScript
CallFlashFunction (functionName [, param1][,param
2][...])
|
Calls a function in the target Flash Movie.
The first parameter is the function name. Further
parameters add arguments to the function call. This requiresActionSpeak™ to be installed .
e.g.:
var obj =
ASPNetMedia.Flash("Flash1");
obj.CallFlashFunction("_root.gotoAndStop",1); |