dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Passing variables from html to flash

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Location
    Cardiff
    Posts
    137

    Passing variables from html to flash

    Ive got links in my webpage, and on clicking one of these I want it to control a selection of images I have in my flash movie.
    Can anybody help me here, I believe I have to pass it through the codebase, but not too sure.

    cheers

    lee
    Accend Web Solutions

    www.accend4web.co.uk

  2. #2
    Denied ACCESSORIES
    Join Date
    Dec 2000
    Location
    Rio de Janeiro
    Posts
    208

    Re: Passing variables from html to flash

    Originally posted by multichild
    Ive got links in my webpage, and on clicking one of these I want it to control a selection of images I have in my flash movie.
    Can anybody help me here, I believe I have to pass it through the codebase, but not too sure.

    cheers

    lee
    yes you need to first of all have swliveconnect="true" set in the embeded flash object within your html


    then you will need to write some javascript
    on your html something like:
    onMouseOver = "function('varstoflash')"

    in your javascript you may have:

    window.document.myFlash.SetVariable("varnameinflas h", infopassed);

    myFlash is the flash name and ID in your HTML

    hope that makes sense
    ..,,;:'""':;,,..ASTRO

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Location
    Cardiff
    Posts
    137
    Hi,

    Umm, im not to sure what you mean to be honest. This is my code:

    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="654" height="238">
    <param name="movie" value="flash/header.swf" />
    <param name="quality" value="high" />
    <embed src="flash/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="654" height="238"></embed>
    </object>

    Where does the swliveconnect action live, and pretty much could you explain further what you mean.

    Sorry im a bit new to this.

    lee
    Accend Web Solutions

    www.accend4web.co.uk

  4. #4
    Senior Member
    Join Date
    Sep 2000
    Location
    Copenhagen, Denmark
    Posts
    228
    you can use this format:

    myfile.swf?var1=val1&var2=val2

    in this way when the swf loads it will (in this case) have a variable called "var1" with a value of "val1" and so forth. this is a pretty simple approach - however you need to remember that your variablenames and values are visible in the code

    cheers
    idi

  5. #5

  6. #6
    Denied ACCESSORIES
    Join Date
    Dec 2000
    Location
    Rio de Janeiro
    Posts
    208
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="654" height="238" id="myFlash">
    <param name="movie" value="flash/header.swf" />
    <param name="quality" value="high" />
    <embed src="flash/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="654" height="238" name="myFlash" swliveconnect="true"></embed>
    </object>
    ok for your flash you would use the following in the header of your html:
    <script language="javascript>
    function sendflash(infopassed){
    window.document.myFlash.SetVariable("varnameinflas h", infopassed);
    }
    </script>

    notice above the bold text where I made changes//////

    in your body html you may have :
    <a href="" onMouseOver = "sendflash('varstoflash')">passing to flash</a>


    now in flash your varnameinflash will be available on root

    so you could access it in flash using _root.varnameinflash

    cheers
    ..,,;:'""':;,,..ASTRO

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center