Groups | Blog | Home
all groups > flash (macromedia) > november 2003 >

flash (macromedia) : Loading Flash Variables From HTML


Wither_8
11/18/2003 11:19:44 PM
Can it be done? I am new to flash and I want to set variables in my embedded SWF file from the HTML file which loads the flash movie.

For example... if you access a PHP script in a web browser, you can set PHP variables by the POST variables in the script's URL.

Is there anything similar for flash?

( I don't mean <object> and <embed> attributes that change things such as width and height, im talking about actually sending flash data from the HTML page or the URL which opens the SWF )

Any help would be much appreciated.

Thank you,
Justin


urami_
11/19/2003 7:55:55 AM


[quoted text, click to view]


Object embed tags can do just that thing .

<PARAM NAME="MOVIE" VALUE="FILE.swf?var=john">
<EMBED SRC="FILE.swf?var=john">


this variable will be first thing that load on flash timeline.
It will than be available for any action , if you trace out with dynamic text field
variable name VAR , it will output for you john.

Now , this require you to add it to the html code , you could use 'document write' to generate
it on the fly and pass the parameters , I would however use different approach .
PHP and pass the parameter with URL .


assume your target html is call index2.html

rename it to index2.php

then you find the filenames (swf files ) in the object/embed tags
and after the names you put ?VAR=<?=$HTTP_GET_VARS["VAR"] ?>

name.swf?preload=<?=$HTTP_GET_VARS["VAR"] ?>

so now if you do index2.php?VAR=1 , the SWF will know VAR is 1

that's pretty much it





Regards

urami_*



<lsym>

There's no place like 127.0.0.1

AddThis Social Bookmark Button