Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 5 of 5

Thread: Html triggering a flash variable

  1. #1

    Html triggering a flash variable

    Would it be possible for a flash variable to change based on an html file?

    Forgive me if this is a novice question, and I'm sure there are much easier ways to do this using PHP, etc. At the moment I only know Html and CSS

    I am using a flash file as my menu, and I'm wondering if there is a way for the html file to trigger flash so that I do not have to make multiple swfs, and cutting down on total files loaded.

    Thanks for the info
    -Mik

  2. #2
    yup, look up flashvars.

    flashvars is a parameter when you embed it... flashvars="hello from html".

    there are other ways of doing this, like with calling a javascript function from flash also.
    or loading an external xml file.

  3. #3
    I still don't quite grasp how to declare variables in as3, how would I declare a string to pick up a flashvar?
    Would something like this work?

    if (root.loaderInfo.parameters.var1 == "1"){
    }

  4. #4
    Can anyone help me out, even with all the guides out there I still can't seem to get it to work. Here is my code. I've spent 3 hours trying to figure this out ;

    Html:
    <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','494','heigh t','54','title','flash1','src','menu2','quality',' high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','menu2' ); //end AC code
    </script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="494" height="54" title="flash1">
    <param name="movie" value="menu2.swf">
    <param name="quality" value="high">
    <param name="FlashVars" value="var1=1"></param>
    <embed src="menu2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="494" height="54" flashVars="var1=1"></embed>
    </object>
    </noscript>

    AS3:
    import flash.display.LoaderInfo;
    var string1:String = getFlashVar("var1");

    function getFlashVar(_var:String):String {
    var paramObj:Object = LoaderInfo(this.loaderInfo).parameters;
    var flashvar:String = String(paramObj[_var]);

    return flashvar;
    }


    Thanks

  5. #5
    I only did the object portion but i think you can figure that part out on your own...
    your problems start here:
    Code:
    1. <param name="FlashVars" value="var1=1"> delete the </param>
    Code:
    2. <embed src="menu2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="494" height="54" flashVars="var1=1">
    try...

    Code:
    <embed src="menu2.swf?var1=1" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="494" height="54" >
    see how that works and let us know... good luck!
    Last edited by maximillion511; November 10th, 2008 at 04:49 PM. Reason: code edit

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012