1

In as2 it was very easy to access query string just using _root, but this doesn't seem to work on as3.

<embed src="loaderInfoExample.swf?a=123" quality="high" bgcolor="#0000ff" width="250" height="50" name="loaderInfoExample" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />

How do i access value of a? I tried it with _root as well as in flash client tried this :-

userNameTextField.text=root.loaderInfo.parameters.a;

But both doesn't seem to work. What can be the problem?

3 Answers 3

2

It should work. Try using SWFObject to include your flash content correctly and pass the parameter as the flashvars part.

Btw. you also should add some check routine to make sure that root.loaderInfo.parameters.a is not null, because assigning null to a TextField's text attribute produces an error.

Sign up to request clarification or add additional context in comments.

2 Comments

But it's auto generated code from Flash. Where do i include it in here? Also object tag should always work why should i use SWFObject? QueryStrings should be accessible in object tag also? The autogenerated code is huge about 320 lines long. :(
If you are using the standard autogenerated code to show your flash content, make sure you pass the flash vars with a new param tag for the object tag. See this page for instructions.
1

look below in the autogenerated code you have to add the FlashVar there as well in order for it to work

<script language="JavaScript" type="text/javascript">
 AC_FL_RunContent(
  'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
  'width', '550',
  'height', '400',
  'src', 'deleteme',
  'quality', 'high',
  'pluginspage', 'http://www.adobe.com/go/getflashplayer',
  'align', 'middle',
  'play', 'true',
  'loop', 'true',
  'scale', 'showall',
  'wmode', 'window',
  'devicefont', 'false',
  'id', 'deleteme',
  'bgcolor', '#ffffff',
  'name', 'deleteme',
  **'FlashVars', 'tester=test',**
  'menu', 'true',
  'allowFullScreen', 'false',
  'allowScriptAccess','sameDomain',
  'movie', 'deleteme',
  'salign', ''
  ); //end AC code
</script>

Comments

0

Try doing that when you're movie is at least inited,

e.g:

this.loaderInfo.addEventListener(Event.INIT, paramsReady);

function paramsReady(event:Event):void{
userNameTextField.text=this.loaderInfo.parameters.a;
}

2 Comments

doesn't help :(. <embed src="loaderInfoExample.swf" FlashVars = "a=123" quality="high" bgcolor="#0000ff" width="250" height="50" name="loaderInfoExample" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="adobe.com/go/getflashplayer" /> <PARAM NAME=FlashVars VALUE="a=123"> This is my flash code this.loaderInfo.addEventListener(Event.COMPLETE, paramsReady); function paramsReady(event:Event):void{ userNameTextField.text=this.loaderInfo.parameters.a; } i get error parameter text must be not null. :(
Interestingly when i deleted all autogenerated code and placed simple object tag as :- permadi.com/tutorial/flashVars/loaderInfoExample.html It works fine!! :):) Now i want to know is there a bug in autogenerated code from flash cs4? i just clicked publish and 300 lines of code got generated and the same query string is not working in that object tag whereas it's working in simple object tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.