3

Is it possible to send params to swf using SWFLoader or something like it?

So.. I want to create swf loader (swf) which would be able to send some Application.application.parameters to swf swf I'm triing to load (which are usualy sent to an application from html.)

how to do such thing?

1
  • Haven't tested this, but try adding them to the url of the SWFLoader instance used to load the SWF. url="Movie.swf?param1=23" Let me know if it works. Commented Mar 1, 2010 at 7:44

2 Answers 2

5

You can add parameters in the URL, sort of like how you would send parameters to a script:

/path/to/the.swf?param=value

They will be available from ActionScript just like regular FlashVars, e.g. via Application.application.parameters["param"] in Flex, LoaderInfo(this.root.loaderInfo).parameters["param"] in AS3 or _root.param in AS2.

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

Comments

2

If you want to share variable between 2 swf then you can use SharedObject.

See for detailed help and a big example:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html#includeExamplesSummary

Or check this for a more comprehensive example: http://drawlogic.com/2008/01/10/howto-sharedobjects-for-local-storage-as3/

Some code to write a variable:

import flash.net.SharedObject;
var so:SharedObject = SharedObject.getLocal("userData");
so.data.username= "user1377";
so.data.pwdhash= "[hash] or pwd";
so.flush(); // writes changes to disk

code to read same variable:

import flash.net.SharedObject;
var so:SharedObject = SharedObject.getLocal("userData");
var username:String = so.data.username;
var pwdhash:String = so.data.pwdhash;

Just like a cookie ;)

Comments

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.