我正在使用项目渲染器,但不断收到此动作错误:
Error: Unknown Property: 'skillName'. at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:338]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/updateParent()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:239]
at mx.binding::Watcher/updateChildren()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:138]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:347]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:375]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at spark.components::DataRenderer/set data()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataRenderer.as:123]
at spark.components::SkinnableDataContainer/updateRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableDataContainer.as:606]
at spark.components.supportClasses::ListBase/updateRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\ListBase.as:1106]
at spark.components::DataGroup/setUpItemRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:1157]
at spark.components::DataGroup/initializeTypicalItem()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:327]
at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:384]
at spark.components::DataGroup/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:1467]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430]
at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:665]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:816]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
奇怪的是,它工作得很好,直到某一点我不断得到这个错误。我一直在谷歌和Stackoverflow上搜索它,并在几个网站上搜索,但没有一个答案可以帮助我进一步。似乎这个错误也主要是在移动AIR项目中抛出,但我的是一个Flash Player项目...
这是itemrenderer的外观:
<?xml version="1.0" encoding="utf-8"?>
<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"
xmlns:components="components.*"
width="100%" height="100%" autoDrawBackground="true"
creationComplete="creationCompleteHandler(event)"
height.login_edit_state="80"
color.login_edit_state="#000000"
height.login_preview_state="80">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
public var loggedin:Boolean = true;
[Bindable]private var ac_projects:ArrayCollection;
protected function creationCompleteHandler(event:FlexEvent):void
{
currentState = "login_preview_state";
img_foldout_preview.addEventListener(MouseEvent.CLICK, changeState);
img_edit_preview.addEventListener(MouseEvent.CLICK, changeState);
http_projects.addEventListener(ResultEvent.RESULT, http_projects_resultEvent);
http_projects.addEventListener(FaultEvent.FAULT, http_projects_faultEvent);
http_projects.url = "http://localhost/sourcefoliocom.adobe.flexbuilder.project.flexbuilder/bindebug/php/getAllProjectsByUserSkill.php?id=" + data.userId + "&skill=" + data.skillId ;
trace("http://localhost/sourcefoliocom.adobe.flexbuilder.project.flexbuilder/bindebug/php/getAllProjectsByUserSkill.php?id="+ data.userId + "&skill=" + data.skillId);
http_projects.send();
}
protected function http_projects_resultEvent(event:ResultEvent):void
{
ac_projects = new ArrayCollection(ArrayUtil.toArray(event.result.projects.project));
rpt_projects.dataProvider = ac_projects;
}
protected function http_projects_faultEvent(event:FaultEvent):void
{
trace("Kon projecten niet laden");
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="http_projects"
method="GET" />
</fx:Declarations>
<s:states>
<s:State name="login_preview_state"/>
<s:State name="login_opened_state"/>
<s:State name="login_edit_state"/>
</s:states>
<s:layout.login_opened_state>
<s:VerticalLayout horizontalAlign="right"/>
</s:layout.login_opened_state>
<!-- login_opened_state -->
<s:SkinnableContainer includeIn="login_opened_state" width="100%" height="80">
<s:layout>
<s:HorizontalLayout gap="20" paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20" verticalAlign="middle"/>
</s:layout>
<s:Label fontSize="20" fontWeight="bold" text="{data.skillName}"/>
<s:Label fontSize="20" text="junior"/>
<s:Spacer width="100%" height="10"/>
<s:Image id="img_edit_open" width="20" height="20" source="images/edit.png" buttonMode="true" useHandCursor="true"/>
<s:Image id="img_foldin_open" width="20" height="20" buttonMode="true" source="images/foldin.png" useHandCursor="true"/>
</s:SkinnableContainer>
<s:VGroup id="vg_opened"
visible="false"
width="900" height="1000" gap="0"
horizontalAlign="right">
<mx:VBox>
<mx:Repeater id="rpt_projects" width="100%">
<components:Project currentItem= {rpt_projects.currentItem}" loggedin="true"/>
</mx:Repeater>
<components:AddProject />
</mx:VBox>
<s:Image x="824" width="76" height="51" source="images/edit_flag.png" useHandCursor="true"/>
</s:VGroup>
</s:ItemRenderer>
此行引发错误:
<s:Label fontSize="20" fontWeight="bold" text="{data.skillName}"/>
填充此渲染器的ArrayCollection是我自己的webservice返回的xml文件。我已经测试过该文件,在这种情况下,skillName的使用应该是正确的。
您是否需要查看更多代码或更多信息?让我知道!
答案 0 :(得分:0)
我发现我正在处理二维ArrayCollection。我没有正确引用此ArrayCollection中的项目,因此这就是无法识别属性的原因。