flex开发积累
1、设置formitem中标签与表单组件之间的距离indicatorGap,实例如下:
?
??? <mx:FormItem label="详细配置:"? indicatorGap="0">
?????<s:DropDownList id="detailSetting" width="200" color="#565656"? dataProvider="{detailSettings}" labelField="label"/>
????</mx:FormItem>
2、在鼠标经过List的某一项时,将其浅蓝色的背景去掉
???? 可以在<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
????xmlns:s="library://ns.adobe.com/flex/spark"
????xmlns:mx="library://ns.adobe.com/flex/mx"
????height="200" width="200"
????mouseOver="simulateItemMouseover()"
????click="simulateItemClick()"
????autoDrawBackground="false">中将autoDrawBackground设置为false即可;
3、flex弹出的窗口不带有遮罩层,PopUpManager.createPopUp(this,AlarmPointMonitorWidget,false)
???? 只要将第三个参数设置为false即可。 此参数是设置模式modal的!
4、Java与flex类型映射问题
???? Java端的方法public String saveStationInfo(EmgEventStationInfo stationInfo)
???? flex端的通过remoteobject调用Java端的上述方法(flex端已经定义好与Java实体对应的实体类EmgEventStationInfo.as);
???? 报了如下异常:
?????????? "Client.Message.Deserialize.InvalidType" faultDetail = (null)
??? faultString = "Cannot convert type flex.messaging.io.amf.ASObject with remote type specified as 'null' to an instance of class zxt.xj.bean.EmgEventStationInfo"
???? 解决方案:在EmgEventStationInfo实体类中添加了[RemoteClass(alias="com.bozch.EmgEventStationInfo ")] ;
?
5、flex的ArrayCollection与Java中ArrayList之间的映射
???? 从flex前端传给java的ArrayCollection是不能够直接映射成相应的ArrayList,需要进行转换;?????????????????????
??? public ArrayList??? convertArrayCollection(ArrayCollection array) {
?????????? ArrayList?target = new ArrayList();
??ASTranslator ast = new ASTranslator();
??EmgEventMonitorFactor myClass;
??ASObject aso;
??for (int i = 0; i < array.size(); i++) {
???? ?myObject = new EmgEventMonitorFactor();
???? ?aso = new ASObject();
???? ?aso = (ASObject) array.get(i);
???? ?aso.setType("包路径.EmgEventMonitorFactor");
????? myClass = (EmgEventMonitorFactor) ast.convert(aso, EmgEventMonitorFactor.class);
????? target.add(myClass);
???? }
???? return target;
?}