Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | Re: FLASH: Multiple FS Commands |
From: | Nigel Randsley-Pena |
Date: | Fri, 3 Sep 1999 15:53:02 +0100 |
Brian,
> Is it possible to pass more than one parameter on an fscommand (or perhaps,
> parse the string of parameters that is passed to javascript).
Yes. There are several ways you can do this. Methods given in no
particular order :
Method 1 -
The FS Command will return one command and one argument. This argument
can be for example a comma seperated list of arguments. Javascript will
receive it a one string.
You can transform it into an array using split as demonstrated in the
following code snippet:
function theMovie_DoFSCommand(command, args) {
var argv = String(args).split(",");
var argc = argv.length;
....more of your code
argc will contain the number of arguments passed and argv is an array
that contains the arguments. To access the first argument, for example,
you would use argv[0].
In the case of the example you quote you could do :
In Flash :
FS Command("launch","test.htm,250,250")
Your Javascript :
function theMovie_DoFSCommand(command, args) {
var argv = String(args).split(",");
var argc = argv.length;
if (command == "launch") {
launcher(String(argv[0]), Number(argv[1]), Number(argv[2]));
}
This will call your launcher function correctly with all arguments
passed to it.
Method 2 Simplified Variant
>From Flash :
FS Command("launcher('test.htm',250,250)","")
notice how only the command field is filled and the args field is empty.
This is a simplified variant of this method that doesn't use the args
field.
Your Javascript:
function theMovie_doFSCommand (command,args) {
eval (command);
}
Nigel
------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-managershocker [dot] com. Problems to: ownershocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-managershocker [dot] com
Replies
FLASH: FlashTalk - Monday, John Croteau
Replies
FLASH: Multiple FS Commands, Brian McHarg
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]