Borizz
%Europe/Berlin %317 %2008, 08:36
Hi All,
Please help, I'm stuck and don t have a clou what to try further.
I suppose the error is in my AS3/MXML, not in the HTML.
A simple demo AS3/MXML would be VERY VERY welcome :-)
I am tryin to read HTMl query script (or FlashVars) in my AS3 code, using loaderInfo.parameters . I have read the examples here and on various other sites, but I cannot get it to work, keep getting Error #1009: Cannot access a property or method of a null object reference. So apparently the Object does not get set, but I do not know why.
*********************************
First, here's the AS3 (I use Flexbuilder3)
*********************************
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
creationComplete="initVars()" >
<mx:Script><![CDATA[
import flash.display.LoaderInfo ;
import flash.display.Loader ;
public function initVars():void
{var testval:String = this.loaderInfo.parameters.var_1;
labeltje.text = testval ;}
]]>
</mx:Script>
<mx:HBox>
<mx:Label text="Name: "/>
<mx:Label id="labeltje" fontWeight="bold"/>
</mx:HBox>
</mx:Application>
******************************
Second, here's the HTML I use
******************************
Note: There's some standard built JS ahead of it, whcih I left out.
Note: I also tried FlashVars in both HTML and Javascript. Same error. Found full HTML-examples on the net, so I guess this is not the problem.
<html lang="en">
<head>
... [some JS]
</head>
<body scroll="no">
... [some JS]
<noscript>
<object classid="clsid:XXX"
id="URL_oef_3" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="URL_oef_3.swf?var_1=hello" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="key" value="XXX" />
<embed src="URL_oef_3.swf?var_1=hello" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="URL_oef_3" align="middle"
play="true"
loop="false"
quality="high"
flashVars="key=XXX"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>
Please help, I'm stuck and don t have a clou what to try further.
I suppose the error is in my AS3/MXML, not in the HTML.
A simple demo AS3/MXML would be VERY VERY welcome :-)
I am tryin to read HTMl query script (or FlashVars) in my AS3 code, using loaderInfo.parameters . I have read the examples here and on various other sites, but I cannot get it to work, keep getting Error #1009: Cannot access a property or method of a null object reference. So apparently the Object does not get set, but I do not know why.
*********************************
First, here's the AS3 (I use Flexbuilder3)
*********************************
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
creationComplete="initVars()" >
<mx:Script><![CDATA[
import flash.display.LoaderInfo ;
import flash.display.Loader ;
public function initVars():void
{var testval:String = this.loaderInfo.parameters.var_1;
labeltje.text = testval ;}
]]>
</mx:Script>
<mx:HBox>
<mx:Label text="Name: "/>
<mx:Label id="labeltje" fontWeight="bold"/>
</mx:HBox>
</mx:Application>
******************************
Second, here's the HTML I use
******************************
Note: There's some standard built JS ahead of it, whcih I left out.
Note: I also tried FlashVars in both HTML and Javascript. Same error. Found full HTML-examples on the net, so I guess this is not the problem.
<html lang="en">
<head>
... [some JS]
</head>
<body scroll="no">
... [some JS]
<noscript>
<object classid="clsid:XXX"
id="URL_oef_3" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="URL_oef_3.swf?var_1=hello" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="key" value="XXX" />
<embed src="URL_oef_3.swf?var_1=hello" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="URL_oef_3" align="middle"
play="true"
loop="false"
quality="high"
flashVars="key=XXX"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
</html>