Flash Vars in Embed Tag
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Flash Vars in Embed Tag

  1. #1
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386

    Flash Vars in Embed Tag

    Okay I know that I can pass variables to Flash via the embed tag like this:

    <param name="flashvars" value="modName=someModName&companyName=someCompany Name&" />

    <embed src="preLoader.swf" quality="high" bgcolor="#ffffff" width="640" height="480" swLiveConnect=true id="preLoader" name="preLoader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"flashvars="modName=someModName&comp anyName=someCompanyName" />

    But is there anyway to pass the varibales to Flash from the url?

    Like:

    <a href = "someHTMLPage.html?modName=someModName&companyName =someCompanyName>Some Page</a>

    How could I get these variables into the Flash movie?

    Thanks.

    _t
    I don't feel tardy.

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,150
    You embed the recieving swf in some javscript embed code.

    code:
    <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>


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

  3. #3
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    Ahhhhh okay. Good thought.

    I'll give it try.

    Thanks

    _t
    I don't feel tardy.

  4. #4
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    pellepiano,

    You are the best. It worked perfectly. I'll try a cow for you.

    Thanks.

    _t
    I don't feel tardy.

  5. #5
    Member
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    52
    hi all,

    Can anyone see a reason why the above code by Pellepiano will work in firefox but in IE it seems to just bring up a blank window with a scrollbar next to where the swf is embedded? This is cinfusing the hell out of me...You help is muchly appreciated.

    Cheers,
    Jman

  6. #6
    Member
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    52
    So, in an effort to get this question answered I ended up placing this same post on several different forums such as Kirupa and Flashkit. A user at Kirupa replied with the following solution which works a treat in both IE and FireFox. Here is the user's response -

    *shudders at code*

    Try doing it with PHP. It'd be very easy, just when you call your swf, use this instead:

    Code:

    middle.swf?<?php echo $_SERVER['QUERY_STRING']; ?>



    And of course, save it as .php.
    Hope this helps anyone with the same problem.

    Cheers,
    Jman

  7. #7
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Did you copy and paste pellepiano's code directly? if so IE is possibly going wrong because the board converted part of the classid attribute into a

    depending on how you want the movie to be cached you might be better off using flashvars instead of appending the query string to the filename. if you add the variables to the filename, each time their values change the movie needs to be reloaded from the server (sometimes this is desirable, sometimes it isn't)

  8. #8
    Member
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    52
    Thanks for getting back. There was a smiley in the middle of the code when I copied it but it looked ok when i pasted it...however perhaps it wasn't. Good to know though and next time I will try that code again.

    For my purposes though, the php code above did the trick. I don't need to use the value more than once. It is just to personalise my flash party invite to the people we are sending it to. So it says, "RecipientName, You're invited!" in the welcome text...and it meant that we could send a different link to each person with their name as the value tagged to the end of the link.

    Of course it would have been even better if I could have worked out a way of sending a group email where the recipient's email address is used as the value instead of their name and when they click on the link to the php page it takes that value cross-references their name in a database or text file and then displays their name in the swf file. Much easier then having to send seperate emails to everyone. Anyways, i guess that's for next time. Of course the only thing I wouldn't know how to do here is how to get their email address sent to the php file with the user only having to click the link in the email.

    By the way, do you know if it is possible to embed flash in an email successfully across multiple platforms?

    Thanks again for your input.

    Cheers,
    Jman

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