calling a variable from html.... how does that work?
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: calling a variable from html.... how does that work?

  1. #1
    Member
    Join Date
    May 2001
    Location
    Dallas, TX
    Posts
    63

    calling a variable from html.... how does that work?

    Ok I am new to heavy actionscripting. However there must be a way to do this.

    What I am looking to do is pull five variables from javascript link into flash when it first loads then make them gloabal variables. After the user completes the flash there will be a link that will use those five variables in a url.

    For instance www.mysite.com.var1var2var3var4var5

    I have a pretty good idea how to do that once I have the variables in flash, but I do not know how to get them from the html, javascript or the link, that calls the flash. Does this make sense?

    Please someone point me towards the right direction.

    Thanks for the wisdom.

    Agent Smith: I want everything.
    Morpheus: Would that include a bullet from this gun?

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,150
    You can specify the variables in the html embed tags...

    ex.
    <EMBED src="pp_ford.swf?myVar1=1356&myVar2=5678"

    ...to get them into Flash.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    1
    I have the same pb and this solution doesn't work (the variable stay empty).

    I have an idea with getURL() or loadVariables()... I'm testin' and be back...
    yW

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,150
    Im using this all the time. However you have to write them in the two places where the swf is specified in the html embed code , for browser compatability. You can even get the variables in there from the url string with some javascript in th embed code.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Location
    San Francisco
    Posts
    196
    Thats exactly what i am needing!
    how does that syntax look?
    something like this maybe?
    src=mySwf.swf?javascript:sendVars();
    ~dev

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,150
    The embed code will look like this.....

    <script language="JavaScript">
    document.write ('<OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" '
    +'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" '
    +'WIDTH=750 HEIGHT=500> <PARAM NAME=movie VALUE="knock.swf'+document.location.search+'">'
    +'<PARAM NAME=quality VALUE=high>'
    +'<EMBED src="knock.swf' +document.location.search+'" '
    +'quality=high WIDTH=750 HEIGHT=500 '
    +'TYPE="application/x-shockwave-flash"></EMBED></OBJECT>')
    </script>

    This will get any variable specified in the urlstring into Flash.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  7. #7
    Senior Member
    Join Date
    Sep 2000
    Location
    San Francisco
    Posts
    196
    Thank you very much, I will use that code in the future. I am trying to pass variables from a swf one frameset to a swf frameset another in Internet Explorer on the mac and it seems to be impossible...

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

Poll by Flashkit.com