[Flex]Flex 4中DropDownList的奇怪出错

  只是个很奇怪的问题,我有一个页面有多个DropDownList,绑定dataProvider没问题,当用代码设置selectedItem或selectedIndex时报Label.as处理异常,怎么会跑到Label里去呢?

ReferenceError: Error #1069: 在 __AS3__.vec.Vector.<flash.display::DisplayObject> 上找不到属性 -1,且没有默认值。
    at spark.components::Label/truncateText()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:1246]
    at spark.components::Label/http://www.adobe.com/2006/flex/mx/internal::composeTextLines()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:485]
    at spark.components.supportClasses::TextBase/measure()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\TextBase.as:533]
    at mx.core::UIComponent/measureSizes()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8042]
    at mx.core::UIComponent/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7966]
    at mx.managers::LayoutManager/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:617]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:733]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

  搜索了很久也没有找到类似的问题和解决,最后用在Adobe的论坛中找到解决方案《exception in Label.as truncateText》(技术的东西还是找官方论坛,够专业有针对性,并自备翻译软件囧`)

  原来在Flex 4下DropDownList字符串过长会出现问题,但Buttons、ComboBox、Panels等就没事(-_-!),应该是DropDownList的bug,用ComboBox代替问题解决

  

你可能感兴趣的:(Flex)