在一个Main的界面,需要用Loader引导不同的Application文件,并通过按钮或者菜单进行控制,同时向Application传递URL的参数。在Samples的explore例子中虽然是写的很清楚,但是如果传递参数就有问题了。
报错的代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.macromedia.com/2003/mxml
">
<mx:Loader id="swfLd" contentPath="loaderC.mxml.swf?sid=123&login=genedna"></mx:Loader>
</mx:Application>
错误是:The reference to entity "login" must end with the ';' delimiter.
修改后的代码是这样
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.macromedia.com/2003/mxml
">
<mx:Script>
<![CDATA[
var url : String = "loaderC.mxml.swf?sid=123&login=genedna";
function Change(){
url = "loaderC.mxml.swf?sid=123&login=中文可以么?";
}
]]>
</mx:Script>
<mx:Loader id="swfLd" source="{url}"></mx:Loader>
<mx:Button label="change" click="Change()"></mx:Button>
</mx:Application>
LoaderC文件如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.macromedia.com/2003/mxml
">
<mx:Script>
<![CDATA[
var sid : String = "None";
var login : String = "None";
]]>
</mx:Script>
<mx:Canvas id="loadC">
<mx:Form>
<mx:FormItem label="sid">
<mx:Text id="loadT" fontSize="14" text="{sid}"></mx:Text>
</mx:FormItem>
<mx:FormItem label="login">
<mx:Text id="loadL" fontSize="14" text="{login}"></mx:Text>
</mx:FormItem>
</mx:Form>
</mx:Canvas>
</mx:Application>
posted on 2007-01-12 13:00
☜♥☞MengChuChen 阅读(288)
评论(0) 编辑 收藏 所属分类:
flex2.0