katya
05-09-2008, 06:48 PM
Hi,
I am trying to use flashVars for the first time, with no success. The swf file comes up, but the fileName is null. I'm guessing its something simple but I've been trying various solutions for about 3 hours and I'm out of ideas!
Based on a number of online tutorials, here is my as3 code:
package {
import flash.display.*;
import flash.text.*;
public class TestApp extends MovieClip {
public function TestApp() {
var fileName:String = root.loaderInfo.parameters.myFileName;
var t = new TextField();
t.autoSize = TextFieldAutoSize.LEFT;
t.text = "The filename is..." + fileName;
addChild(t);
} } }
And the html file (using dreamweaver)
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','550','heigh t','500','title','PreQuiz Reloaded','src','../Prequiz','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','../Prequiz' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="550" height="500" title="PreQuiz Reloaded">
<param name="movie" value="../Prequiz.swf" />
<param name="quality" value="high" />
<param name="FlashVars" value="myFileName=prequiz"/>
<embed src="../Prequiz.swf" FlashVars="myFileName=prequiz" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="500"></embed>
</object></noscript>
If I run this inside Flash and do a trace on root.loaderInfo.parameters, the output confirms its an Object. But the textbox (both in flash and in a browser) says the filename is null.
Thank you!!
I am trying to use flashVars for the first time, with no success. The swf file comes up, but the fileName is null. I'm guessing its something simple but I've been trying various solutions for about 3 hours and I'm out of ideas!
Based on a number of online tutorials, here is my as3 code:
package {
import flash.display.*;
import flash.text.*;
public class TestApp extends MovieClip {
public function TestApp() {
var fileName:String = root.loaderInfo.parameters.myFileName;
var t = new TextField();
t.autoSize = TextFieldAutoSize.LEFT;
t.text = "The filename is..." + fileName;
addChild(t);
} } }
And the html file (using dreamweaver)
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','550','heigh t','500','title','PreQuiz Reloaded','src','../Prequiz','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movi e','../Prequiz' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="550" height="500" title="PreQuiz Reloaded">
<param name="movie" value="../Prequiz.swf" />
<param name="quality" value="high" />
<param name="FlashVars" value="myFileName=prequiz"/>
<embed src="../Prequiz.swf" FlashVars="myFileName=prequiz" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="500"></embed>
</object></noscript>
If I run this inside Flash and do a trace on root.loaderInfo.parameters, the output confirms its an Object. But the textbox (both in flash and in a browser) says the filename is null.
Thank you!!