类型强制失败:无法将Object @ a001d91转换为AS.Floor

时间:2011-07-05 22:32:25

标签: actionscript-3 mobile flex4.5 flashbuilder4

好吧这是让我心理上的,我无法将任何东西转换为我的自定义类,它首先说的是关于地板,所以我删除它们,然后关于空间,然后关于borgevent(不是实际事件,它包含一些字符串数据)比如名字和日期),之后它给了我所有mi类型转换的盛大之旅....

<fx:Script>
    <![CDATA[
        import AS.BORGEvent;
        import AS.Floor;
        import AS.Room;

        import mx.collections.ArrayCollection;
        import mx.events.FlexEvent;

        import spark.events.IndexChangeEvent;

        [Bindable]
        protected var myList:ArrayCollection = new ArrayCollection();
        //protected var original:ArrayCollection = new ArrayCollection();
        protected function goback(event:MouseEvent):void
        {
            // TODO Auto-generated method stub
            navigator.popView();
        }

        protected function makeList(event:FlexEvent):void
        {
            for(var i:uint=0;i<Floor(data).rooms.length;i++){
                for(var j:uint=0;j<Room(Floor(data).rooms.getItemAt(i)).events.length;j++){
                    myList.addItem(new BORGEvent(
                        BORGEvent(Room(Floor(data).rooms.getItemAt(i)).events.getItemAt(j)).evtName,
                        BORGEvent(Room(Floor(data).rooms.getItemAt(i)).events.getItemAt(j)).evtDate,
                        BORGEvent(Room(Floor(data).rooms.getItemAt(i)).events.getItemAt(j)).evtType));
                }
            }
            //trace(myList.length);
        }

    ]]>
</fx:Script>


<fx:Declarations>
    <s:Button label="back" id="backBtn" click="goback(event)"/>
</fx:Declarations>

<s:List
    width="100%"
    height="100%"
    dataProvider="{myList}"
    itemRenderer="Renderers.SmthRendere"
    >
    <s:layout>
        <s:VerticalLayout paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5"/>
    </s:layout>
</s:List>

这是错误:

TypeError: Error #1034: Type Coercion failed: cannot convert Object@a001d91 to AS.Floor.
at Views::BORG_EventsView/view1_initializeHandler()[C:\Users\addex\Adobe Flash Builder 4.5\BORG final\src\Views\BORG_EventsView.mxml:48]
at Views::BORG_EventsView/___BORG_EventsView_View1_initialize()[C:\Users\addex\Adobe Flash Builder 4.5\BORG final\src\Views\BORG_EventsView.mxml:9]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]
at mx.core::UIComponent/set processedDescriptors()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:1871]
at mx.core::UIComponent/initializationComplete()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:7660]
at mx.core::UIComponent/initialize()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:7639]
at spark.components::View/initialize()[E:\dev\4.5.1\frameworks\projects\mobilecomponents\src\spark\components\View.as:990]
at Views::BORG_EventsView/initialize()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:7485]
at mx.core::UIComponent/addChildAt()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:7189]
at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\Group.as:2037]
at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\Group.as:1628]
at spark.components::Group/addElementAt()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\Group.as:1387]
at spark.components::Group/addElement()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\Group.as:1345]
at spark.components::SkinnableContainer/addElement()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:761]
at spark.components::ViewNavigator/createViewInstance()[E:\dev\4.5.1\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1954]
at spark.components::ViewNavigator/commitNavigatorAction()[E:\dev\4.5.1\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1867]
at spark.components::ViewNavigator/commitProperties()[E:\dev\4.5.1\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1236]
at mx.core::UIComponent/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:8209]
at mx.managers::LayoutManager/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:597]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:783]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]

应用程序似乎唯一出错的是我正在尝试将数据项转换为一个楼层对象,该数据项是从第一个视图成功传递到楼层对象....,直到大约一个小时以前工作过,突然之间...认为这是我做过的事情,然后把所有事情都改回来,直到它起作用为止,但仍然没有......还阅读了大部分有关此事的文章,并没有真正帮助

0 个答案:

没有答案