flex3 弹出窗口 传递值 怎么办啊 20
首先我的主文档scr.mxml里面有个<mx:HorizontalListid="horizontallist"dataProvider="{arr1}"labelFie...
首先 我的主文档scr.mxml里面有个
<mx:HorizontalList id="horizontallist" dataProvider="{arr1}" labelField="label" iconField="thumbnailImage" itemRenderer="stomItemRenderer">
</mx:HorizontalList>
然后 arr1是
<mx:Array id="arr1">
<mx:Object label="大嘴巴-爱不爱我" thumbnailImage="img/new img/abaw.jpg"/>
<mx:Object label="王心凌-Happy Loving" thumbnailImage="img/new img/happy loving.jpg"/>
</mx:Array>
接着stomItemRenderer.mxml是和scr.mxml在同一目录下的 stomItemRenderer.mxml内容是
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center">
<mx:Image source="{data.thumbnailImage}"/>
<mx:Label text="{data.label}"/>
<mx:click>
<![CDATA[
_img1(event)
]]>
</mx:click>
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager
import mx.containers.TitleWindow
import gtnew.newgt;
private var tc:newgt
private function _img1(evt:MouseEvent):void {
tc = newgt(PopUpManager.createPopUp( this, newgt , true));
PopUpManager.centerPopUp(tc)
tc.x=250
tc.y=100
}
]]>
</mx:Script>
</mx:VBox>
最后弹出的窗口 newgt.mxml的内容是
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="" fontSize="12" showCloseButton="true" width="500" height="500">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager
]]>
</mx:Script>
<mx:close>
<![CDATA[
PopUpManager.removePopUp(this)
]]>
</mx:close>
</mx:TitleWindow>
现在弹出窗口做到了 我现在希望弹出的这个窗口newgt的title正好是我在scr.mxml中的HorizontalList中的图片对应的名字 比如我现在单击大嘴巴-爱不爱我 我就希望弹出的窗口的title也为大嘴巴-爱不爱我 怎么做到啊? 展开
<mx:HorizontalList id="horizontallist" dataProvider="{arr1}" labelField="label" iconField="thumbnailImage" itemRenderer="stomItemRenderer">
</mx:HorizontalList>
然后 arr1是
<mx:Array id="arr1">
<mx:Object label="大嘴巴-爱不爱我" thumbnailImage="img/new img/abaw.jpg"/>
<mx:Object label="王心凌-Happy Loving" thumbnailImage="img/new img/happy loving.jpg"/>
</mx:Array>
接着stomItemRenderer.mxml是和scr.mxml在同一目录下的 stomItemRenderer.mxml内容是
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center">
<mx:Image source="{data.thumbnailImage}"/>
<mx:Label text="{data.label}"/>
<mx:click>
<![CDATA[
_img1(event)
]]>
</mx:click>
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager
import mx.containers.TitleWindow
import gtnew.newgt;
private var tc:newgt
private function _img1(evt:MouseEvent):void {
tc = newgt(PopUpManager.createPopUp( this, newgt , true));
PopUpManager.centerPopUp(tc)
tc.x=250
tc.y=100
}
]]>
</mx:Script>
</mx:VBox>
最后弹出的窗口 newgt.mxml的内容是
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="" fontSize="12" showCloseButton="true" width="500" height="500">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager
]]>
</mx:Script>
<mx:close>
<![CDATA[
PopUpManager.removePopUp(this)
]]>
</mx:close>
</mx:TitleWindow>
现在弹出窗口做到了 我现在希望弹出的这个窗口newgt的title正好是我在scr.mxml中的HorizontalList中的图片对应的名字 比如我现在单击大嘴巴-爱不爱我 我就希望弹出的窗口的title也为大嘴巴-爱不爱我 怎么做到啊? 展开
展开全部
很简单
1.先去掉 _img1(event) 事件监听
2.在 HorizontalList 上添加 click="{openWin(horizontallist.selectedItem)}"
3.openWin 方法为
private function openWin(item:Object):void{
tc = newgt(PopUpManager.createPopUp( this, newgt , true));
PopUpManager.centerPopUp(tc)
tc.x=250
tc.y=100
tc.title = item.label;
}
1.先去掉 _img1(event) 事件监听
2.在 HorizontalList 上添加 click="{openWin(horizontallist.selectedItem)}"
3.openWin 方法为
private function openWin(item:Object):void{
tc = newgt(PopUpManager.createPopUp( this, newgt , true));
PopUpManager.centerPopUp(tc)
tc.x=250
tc.y=100
tc.title = item.label;
}
展开全部
private function _img1(evt:MouseEvent):void {
tc = newgt(PopUpManager.createPopUp( this, newgt , true));
tc.title = evt.target.label;
PopUpManager.centerPopUp(tc)
tc.x=250
tc.y=100
}
中间加上
tc.title = evt.target.label;
这一句
不行吗?
tc = newgt(PopUpManager.createPopUp( this, newgt , true));
tc.title = evt.target.label;
PopUpManager.centerPopUp(tc)
tc.x=250
tc.y=100
}
中间加上
tc.title = evt.target.label;
这一句
不行吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把想传递的东西都往弹出框的data属性里扔
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询