# Read HTML query string in AS3/SWF

**URL:** <https://forum.kirupa.com/t/read-html-query-string-in-as3-swf/272130>\
**Category:** Uncategorized\
**Created:** [October 2, 2008, 8:45am UTC](https://forum.kirupa.com/t/read-html-query-string-in-as3-swf/272130 "2008-10-02T08:45:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Borizz](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@Borizz](https://forum.kirupa.com/u/Borizz)\
**Post date:** [October 2, 2008, 8:45am UTC](https://forum.kirupa.com/t/read-html-query-string-in-as3-swf/272130/1 "2008-10-02T08:45:43Z")

</div>

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]](http://www.adobe.com/2006/mxml%5B/COLOR%5D%5B/SIZE%5D%5B/COLOR%5D%5B/SIZE%5D%5BSIZE=2%5D) [/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]
