Flex开发总结

来源:互联网 发布:游戏币交易网站源码 编辑:程序博客网 时间:2024/06/06 03:04

2个月的Flex开发,遇到不少问题。包括官方的bug。记录下来

 

1. IDE的问题:经常遇到Flex不编译,eclipse中设置成自动编译,还是不行。解决办法:更改mxml文件,随便找个地方价格空格,保存,只要没语法问题就会编译。

   以前用WebSphere开发的时候,也经常遇到jsp编译问题,解决办法仍然是更改文件,copy到WebSphere的部署目录下,WebSphere就会重新编译jsp文件

 

  如果上面的办法还是行不通,可能是你的配置出问题

  .flexProperties,.actionScriptProperties 看上去正确也不能编译,你需要重建配置Flex Project 属性,是flex builder的bug,官方网站有讨论

 

2. 在TextInput 的KeyDown事件中处理更改text属性问题:

  问题描述:当你需要输入2009-09-09,程序自己添加" - ".

 

 <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Script>
  <![CDATA[
   private function handleKeyDown(event:KeyboardEvent):void
   {
    if(event.keyCode != Keyboard.BACKSPACE && event.keyCode != Keyboard.DELETE)
    {
     if(txt.text.length == 2 || txt.text.length == 5 || txt.text.length == 8){      
      txt.text += "-";          
      txt.setSelection(txt.text.length, txt.text.length);
      txt.validateNow();     
     }
    }
   }
  ]]>
 </mx:Script>
 <mx:TextInput id="txt" keyDown="handleKeyDown(event)" x="221" y="192"/>
</mx:Application>

 

 

https://bugs.adobe.com/jira/browse/SDK-18364

Setting TextInput text attribute in enter handler does not change displayed text

 

If you enter text into a halo TextInput and in your enter handler set the text to something else that text change is lost.

The reason is that user's enter handler which sets the text runs before the change handler. The change handler calls textFieldChanged() which overwrites _text with the value from textField.text so the user's change is lost.

If the user's enter handler calls validateNow() after setting the text, the change sticks because commitProperties is called before the change handler.

 

未完,待续。。。。空了在写

原创粉丝点击