현재 ArrayCollection 객체의 양방향 바인딩을 구현하려고합니다. 그러나 COLLECTION_CHANGE 이벤트가 발생하지 않습니다.플렉스 4 COLLECTION_CHANGE 이벤트가 실행되지 않음
App.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application 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.*"
creationComplete="handleCreationComplete(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var booths:ArrayCollection;
public function handleCreationComplete(event:Event):void
{
// ADD SOME BOOTHS
booths = new ArrayCollection();
booths.addItem("item1");
booths.addItem("item2");
}
]]>
</fx:Script>
<components:FloorplanGrid id="grid" width="400" height="300" booths="{booths}" />
</s:Application>
FloorplanGrid.as
package components
{
import mx.collections.ArrayCollection;
import mx.events.CollectionEvent;
import spark.components.Group;
[Event(name="collectionChanged", type="events.CollectionEvent")]
public class FloorplanGrid extends Group
{
[Bindable]
public var booths:ArrayCollection = new ArrayCollection();
public function FloorplanGrid()
{
booths.addEventListener(CollectionEvent.COLLECTION_CHANGE, handleBoothsChange);
super();
}
private function handleBoothsChange(event:CollectionEvent):void
{
trace("HANDLE BOOTHS CHANGE");
/* draw booths */
}
}
}
은 내가 부스 변수 바인딩이 방향을 달성하기 위해 노력하고있어.
public var booths:ArrayCollection = new ArrayCollection();
그런데 : 나는 문제는 당신이이 컬렉션의 collectionChange
이벤트를 구독하는 App.mxml