views:

16

answers:

0

Hi all, My class in ActionScript works perfectly, it all it's job but my only concern is that I have a textfield binded to a getter property and although this initially works perfectly, whenever the property updates the value will not change on the textfield =(

public function get XMLCollisions():String
{
   var s:String = new String();
   s += "<root>\n";
   for ( var i:int = 0; i < this._collisions.length; i++)
   {
      var c:CollisionPoint = this.Collisions.getItemAt(i) as CollisionPoint;
      s += c.toXML();
    }
    s += "</root>\n";
    return s;
}

As you can see the getter returns a different value depending on the number of CollisionPoint..

<s:TextArea x="20" y="449" width="630" height="303" id="XMLTextArea" text="{this._collisionDisplayManager.XMLCollisions}"/>

This textfield is binded to it's getter, but will never change in time.

Looking on the forums looks that I have to implement some sort of event dispatcher, I tried but unfortunately when i call EventDispatcher.initialize() in the constructor it throws me an error..

I have imported flash.events.EventDispatcher;

here is the constructor....

package Collision
{
import flash.events.Event;
 import flash.events.EventDispatcher;

 import mx.collections.ArrayList;
 import mx.core.IVisualElementContainer;
 import mx.events.CollectionEvent;

 public class CollisionDisplayManager
 {
   private var _uIDList:int;
 private var _collisions:ArrayList;
 private var _visual:IVisualElementContainer;


 public function CollisionDisplayManager(visual:IVisualElementContainer)
 {
    this._uIDList = 0;
    this._collisions = new ArrayList();
    this._collisions.addEventListener(CollectionEvent.COLLECTION_CHANGE, reloadTable);

    if (visual == null) throw new Error("Visual is NULL");
       this._visual = visual;

    EventDispatcher.initialize(); // Call to possibly undefined method itialize....
 }

Does someone know what have I done wrong???

Thanks for your help!