Skip navigation
Currently Being Moderated

problem regarding FlashVars

Apr 27, 2011 5:35 AM

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
   
<head>
       
<title>flashVarsTests</title>
       
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       
<style type="text/css" media="screen">
        html
, body { height:100%; background-color: #ffffff;}
        body
{ margin:0; padding:0; overflow:hidden; }
       
#flashContent { width:100%; height:100%; }
       
</style>
   
</head>
   
<body>
       
<div id="flashContent">
           
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="flashVarsTests" align="middle">
               
<param name="movie" value="flashVarsTests.swf" />
               
<param name="quality" value="high" />
               
<param name="bgcolor" value="#ffffff" />
               
<param name="play" value="true" />
               
<param name="loop" value="true" />
               
<param name="wmode" value="window" />
               
<param name="scale" value="showall" />
               
<param name="menu" value="true" />
               
<param name="devicefont" value="false" />
               
<param name="salign" value="" />
               
<param name="allowScriptAccess" value="sameDomain" />
               
<param name="flashvar" value="message1=HelloWorld" />
               
<!--[if !IE]>-->
               
<object type="application/x-shockwave-flash" data="flashVarsTests.swf" width="550" height="400">
                   
<param name="movie" value="flashVarsTests.swf" />
                   
<param name="quality" value="high" />
                   
<param name="bgcolor" value="#ffffff" />
                   
<param name="play" value="true" />
                   
<param name="loop" value="true" />
                   
<param name="wmode" value="window" />
                   
<param name="scale" value="showall" />
                   
<param name="menu" value="true" />
                   
<param name="devicefont" value="false" />
                   
<param name="salign" value="" />
                   
<param name="allowScriptAccess" value="sameDomain" />
                   
<param name="flashvar" value="message1=HelloWorld" />
               
<!--<![endif]-->
                   
<a href="http://www.adobe.com/go/getflash">
                       
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
                   
</a>
               
<!--[if !IE]>-->
               
</object>
               
<!--<![endif]-->
           
</object>
       
</div>
   
</body>
</html>

 

above code is the generated html.

I use Flash Professional CS5 Actionscript 3.0

 

Here's the code in my Flash file

 

if(root.loaderInfo.parameters["flashvars"] != null){
    myText.text = root.loaderInfo.parameters["flashvars"];
}

 

Just trying to display the flashvars on to the stage with the text named myText

 

By the way this part <param name="flashvar" value="message1=HelloWorld" /> I only put this after generating the html file through flash.

 

 

Any response is greatly appreciated.

 
Replies
  • Currently Being Moderated
    Apr 27, 2011 5:41 AM   in reply to xxxheeroxxx

    Just a quick noticing that you use both "flashvars" versus "flashvar"

      

    <param name="flashvar" value="message1=HelloWorld" />

     

    versus

      

     

    if(root.loaderInfo.parameters["flashvars"] != null){
        myText.text = root.loaderInfo.parameters["flashvars"];
    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2011 6:21 AM   in reply to xxxheeroxxx

    I don't think you are accessing/testing the correct things.  Try changing yourFlash code to...

     

    var params:Object = LoaderInfo(root.loaderInfo).parameters;
    if(params != null){
        myText.text += String(params["message1"]);
    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 27, 2011 7:30 AM   in reply to xxxheeroxxx

    You're welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points