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.
[LEFT]A simple demo AS3/MXML would be VERY VERY welcome [/LEFT]
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 cannor 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.
Here’s the relevant HTML (embedded in noscript and object tags), like example on this forum.
<param name=“movie” value=“URL_oef_3.swf?var_1=XYZ” />
…
<embed src=“URL_oef_3.swf?var_1=XYZ” quality=“high” bgcolor="#ffffff"
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.
Here’s the full MXML app (I build a SWF from it before running it in the HTML, obviously).
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]<mx:Application [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]xmlns:mx=[/SIZE][SIZE=2][COLOR=#990000][SIZE=2][COLOR=#990000]http://www.adobe.com/2006/mxml[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE]
[SIZE=2]creationComplete=“initVars()” [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#006633][SIZE=2][COLOR=#006633]<mx:Script>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]<![CDATA[[/SIZE]
[SIZE=2][COLOR=#0033ff][SIZE=2][COLOR=#0033ff]import[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] flash.display.LoaderInfo ;[/SIZE]
[SIZE=2][COLOR=#0033ff][SIZE=2][COLOR=#0033ff]import[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] flash.display.Loader ;[/SIZE]
[SIZE=2][COLOR=#0033ff][SIZE=2][COLOR=#0033ff]public [/COLOR][/SIZE][/COLOR][/SIZE]****[SIZE=2][COLOR=#339966][SIZE=2][COLOR=#339966]function[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] initVars():[/SIZE][SIZE=2][COLOR=#0033ff][SIZE=2][COLOR=#0033ff]void[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]{[/SIZE][SIZE=2][COLOR=#6699cc][SIZE=2][COLOR=#6699cc]var[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] testval:String = [/SIZE][SIZE=2][COLOR=#0033ff][SIZE=2][COLOR=#0033ff]this[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].loaderInfo.parameters.var_1; [/SIZE]
[SIZE=2]labeltje.text = testval ;[/SIZE][SIZE=2]}[/SIZE]
[SIZE=2]]]>[/SIZE]
[SIZE=2][COLOR=#006633][SIZE=2][COLOR=#006633]</mx:Script>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]<mx:HBox>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]<mx:Label[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] text="[/SIZE][SIZE=2][COLOR=#990000][SIZE=2][COLOR=#990000]Name: [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]/>[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]<mx:Label[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] id="[/SIZE][SIZE=2][COLOR=#990000][SIZE=2][COLOR=#990000]labeltje[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]" fontWeight="[/SIZE][SIZE=2][COLOR=#990000][SIZE=2][COLOR=#990000]bold[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]/>[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]</mx:HBox>[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[LEFT][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]</mx:Application>[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[LEFT]Thanks a lot!
B[/LEFT]