Flex 4 接收外部参数(1)
(一)使用flashVars传递
1 更改index.template.html第43行为:
?
trace("URL参数=>");trace(app.url);?
?输出结果如下:
?
HTML参数=>{"age":20,"sex":1}??
(四)代码汇总如下:
?
?写道import com.adobe.serialization.json.JSON;?? ?详细请下载附件,其中项目使用了as3corelib.swc包,请自己搜索或者联系我。
?
注1:
swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes)有5个必须的参数和4个可选的参数:
?? ?1. swfUrl(String,必须的)指定SWF的URL。
?? ?2. id(String,必须的)指定将会被Flash内容替换的HTML元素(包含你的替换内容)的id。
?? ?3. width(String,必须的)指定SWF的宽。
?? ?4. height(String,必须的)指定SWF的高。
?? ?5. version(String,必须的)指定你发布的SWF对应的Flash Player版本(格式为:major.minor.release)。
?? ?6. expressInstallSwfurl(String,可选的)指定express install SWF的URL并激活Adobe express install [ http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 ]。
?? ?7. flashvars(String,可选的)用name:value对指定你的flashvars。
?? ?8. params(String,可选的)用name:value对指定你的嵌套object元素的params。
?? ?9. attributes(String,可选的)用name:value对指定object的属性。
?
注2:对于flex3,,flashVars参考链接:
http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_3.html
http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_5.html#245869:
?
?
?
?
?