I'm building a simple app and trying to get the PropertyChangeEvent to
work properly as an alternative to using an explicit eventDispatch call.
I can't seem to get the updated variable to be recognized by the main
apps component.

In my AS3 class I have set the class to [Bindable] so that all the
properties can be bound to the appropriate controls in the main.mxml
file. I've used this import to bring in the PropertyChangeEvent:
import mx.events.PropertyChangeEvent;
A timer fires from the main.mxml file and calls the setLastChecked
function passing in a new Date object(new Date()) to trigger the update
of the variable like this:

private function setLastChecked(value:Date):void
     {
             var oldValue:Object = _lastChecked;
             _lastChecked = value;

         notifyPropertyChange("lastChecked", oldValue, value);
         }


         private function
notifyPropertyChange(name:String,oldValue:Object,value:Object):void
         {
             if (value !== oldValue)
             {
                
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, name,
oldValue, value));
             }
         }

The variable "lastChecked" is bound to a textfield in the main.mxml file
like so:

<mx:Text
text="{formatDate(subscriptionsList.selectedItem.lastChecked)}"/>
which formats the data as a string to display the date.

The problem is that the variable is never updated on screen. I've been
able to confirm that the event from the timer fires, triggers the
notifyPropertyChange event but that event is never received from the
Text component or received within the main.mxml app.
Is there something I'm missing throughout this process or need to add to
get the event recognized in the main app??!!




Reply via email to