Skip navigation

Great things come in small packages.

On occasion you’ll want a quick clean way to call a function in your view based off changes in the model. For example, when a bool changes show a popup window. Now you can do this without fussing around with setters. The below class was written by Paul Williams from Adobe Consulting.

package com.adobe.ac.util
{
   public class Observe
   {
      public var handler : Function; 

      public function set source( source : * ) : void
      {
         handler.call();
      }
   }
}

Note it can only be used by MXML.

Application

View Source

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: