易截截图软件、单文件、免安装、纯绿色、仅160KB

flex repeater控件Repeater is not executing"的异常


flex repeater控件注意
Repeater 顾名思义,Repeat就是重复的意思, Repeater 就是用来重复的控件
Repeater 会根据数据源中对象的多少来产生多少个子项,生成的子项全部是以数组形式存在的
<mx:Repeater id="myRepeater" dataProvider="{myArray}">
        <mx:HBox>
        <mx:LinkButton id="myLabel" label="{myRepeater.currentItem.name}" click="show(event.currentTarget.getRepeaterItem())"/>
        <mx:TextInput text="{myRepeater.currentItem.age}"/>
        </mx:HBox>
</mx:Repeater>
有个常见的问题:
发现没有,我们平时调用函数时传递Repeater 中的字段作为参数时,是不可以传递的会出现" Repeater is not executing"的异常
但是有getRepeaterItem()这个东东,是解决这个问题的最好的方案
甚至我们不需要传递getRepeaterItem()
传递一个event过去就好了,使用event.currentTarget.getRepeaterItem(),
同样可以获得当前对象的currentItem
,还有一个建议就是我们平时如果能用DataGrid解决的,就不要使用Repeater去处理,Repeater在效率会上大打折扣
建议学习flex的人去http://livedocs.adobe.com/flex/3/html/index.html官方flex文档去看看
虽然英文不好,但是代码我们总能看懂,对学习flex的人大有裨益
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<!--[CDATA[
import mx.messaging.AbstractConsumer;
import mx.collections.ArrayCollection;
private var my:Array=[{name:"a",age:1},{name:"b",age:2},{name:"c",age:3}];
[Bindable]
private var dp:ArrayCollection=new ArrayCollection(my);
]]-->
</mx:Script>
<mx:VBox x="144" y="118" width="319" height="224">
<mx:Repeater id="rp" dataProvider="{dp}">
<mx:RadioButton label="{rp.currentItem.name}" click="aa.text=event.target.getRepeaterItem().age"/>


</mx:Repeater>
<mx:TextInput id="aa"/>
</mx:VBox>
</mx:Application>


相关文档:

J2EE集成Flex环境搭建

相关下载
Flex正式版EXE下载地址:
http://trials.adobe.com/Applications/Flex/FlexBuilder/3/FB3_WWEJ.exe
Flex正式版插件下载地址:
http://trials.adobe.com/Applications/Flex/FlexBuilder/3/FB3_WWEJ_Plugin.exe
 
LCDS
官方下载(需要先注册)
 
https://www.adobe.com/cfusion/tdrc/index.cfm?p ......

flex中,带最小化,最大化,关闭的Panel

package
{
import mx.containers.Panel;
import mx.controls.Button;
import flash.events.Event;
import mx.events.FlexEvent;
import flash.events.MouseEvent;
import mx.controls.Alert;
/**
* This class is used to create a Custom Panel
* with Maximum, Minimum, close
* and also drag p ......

Flex中image控件如何添加边框

页面代码:
<?xml version="1.0"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:marsImage="mars.display.*"
backgroundColor="#000000"
layout="absolute">

<marsImage:BorderImage
borderAlpha="{aBar.value ......

Flex与服务器交互之一(URLRequest +URLLoader应用)

   由于Flex只是一种客户端技术其本身并不能直接同数据库交互,在实际的应用开发过程中Flex提供了如URLRequest、HTTPService、RemoteObject、WebService等类以实现同服务器的通讯和数据交互,下面做一些介绍和实例解析:
   1、使用URLRequest向服务器发送请求,使用URLLoader接收服务器返回的数据:
& ......

flex 实现横向树状图

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="initApp()"
backgroundColor="#FFFFFF">
<mx:Canvas id="paper"
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号