开发者

Correct way of passing and reading parameters to a .swf in Flex?

What is the preferred way of passing parameters to a Flex application deployed as a .swf and how do I read the parameters 开发者_运维知识库from Flex?

I'm looking for the equivalent of passing and reading URL parameters in Flex land.


I like to use FlashVars.

var paramObj:Object = Application.application.parameters;
trace(paramObj['foo']);


public function getQuerystringProperty(property:String):String {
  var bm:IBrowserManager = BrowserManager.getInstance();
  var oArgs:Object = {};
  bm.init("", "");
  oArgs = mx.utils.URLUtil.stringToObject(bm.fragment, “&”);
  if (oArgs[property])
    return oArgs[property].toString();
  return "";
}

Gets the QueryString from within Flex (no ExternalInterface).


embed the swf object in an html page and then use external interface. These articles should help you:

http://www.adobe.com/livedocs/flex/2/langref/flash/external/ExternalInterface.html

Flex Examples

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜