HOWTO: AutoPlay Media Studio 4.0 and Flash Interaction
Document ID: IR04044The information in this article applies to:
- AutoPlay Media Studio 4.0
SUMMARY
This article provides information on the interaction between AutoPlay Media Studio 4.0 and Flash.
DISCUSSION
In general, any interaction between AutoPlay Media Studio 4.0 and Flash is done through FS Commands.
Each Flash object in AutoPlay Media Studio 4.0 has an On FS Command event. This event is fired each time an FS Command is fired in the Flash movie. You can use the FlashObject.GetProperty() action to retrieve the Last FSCommand and the Last FSCommand Args.
FS Commands are fired in Flash in the following manner:
fscommand("Command", "Arguments")
Where "Command" is the command that will be executed and "Arguments" is the argument that will be used when the command is executed. For more information on this please see Macromedia's online ActionScript Dictionary: http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary372.html
For example, if we wanted to display a message box in AutoPlay Media Studio 4.0 based upon an FS Command we could do the following:
The first step would be to set up the FS Command in our Flash movie. Since we are displaying a message box we will use "AMS4MessageBox" as our command and our argument will be the text that we want to display. This is what our FS Command will look like:
fscommand("AMS4MessageBox", "Display this text.")
Now in order to trap this FS Command we need to add actions to the On FS Command event of our Flash object. The first two actions will be as follows:
%FSCommand% = FlashObject[FlashOb1].GetProperty ("Last FSCommand")
%FSArg% = FlashObject[FlashOb1].GetProperty ("Last FSCommand Args")
The first action gets the last FS Command and stores it in the variable %FSCommand%. The second action gets the argument and stores it in %FSArg%.
If the FS Command that we defined above was fired the two actions would set %FSCommand% equal to "AMS4MessageBox" and %FSArg% equal to "Display this text.".
Since more than one FS Command can be fired by a Flash movie, we need to test the value of the FS Command in order to know what to do. To test the value of the command we will use an If condition:
IF (%FSCommand% = "AMS4MessageBox")
If our FS Command is the FS Command that we are looking for ("AMS4MessageBox") we want to show a message box. To do so we will use Dialog.MessageBox() action, and use %FSArg% as our Message:
%Result% = Dialog.MessageBox ("Alert", "%FSArg%", Ok, Exclamation)
Here is the entire action script:
%FSCommand% = FlashObject[FlashOb1].GetProperty ("Last FSCommand")
%FSArg% = FlashObject[FlashOb1].GetProperty ("Last FSCommand Args")
IF (%FSCommand% = "AMS4MessageBox")
%Result% = Dialog.MessageBox ("Alert", "%FSArg%", Ok, Exclamation)
END IF
IF (%FSCommand% = "AMS4Exit")
Application.Exit
END IF
You will notice that the above action script also checks to see if the FS Command "AMS4Exit" was fired, and if it was it closes the AutoPlay application.
MORE INFORMATION
For more information please see the following topics in the AutoPlay Media Studio 4.0 help file:
- Command Reference | Actions | Flash Object | Get Property
- Command Reference | Actions | Dialog | Message Box
- Command Reference | Actions | Control Structure | IF
- Command Reference | Actions | Control Structure | END IF
- Command Reference | Actions | Application | Exit
- Command Reference | Objects | Flash Object
- User's Guide | Key Concepts | Variables
KEYWORDS: AutoPlay Media Studio 4.0, Flash, Interaction, FS Commands
Last reviewed: November 1, 2002
Copyright © 2002 Indigo Rose Corporation. All rights reserved.