0 Replies Latest reply on Apr 25, 2007 11:37 AM by sdfwaefawef

    Cairngorm in Flash CS3 (NOT Flex)


      I've been reading up on the Cairngorm architecture that Adobe recommends as best practice for devevloping RIA's in Flex.


      I recently purchased Flash CS3 and want to find a way to implement Cairngorm in my upcomming RIAs that will be built in Flash instead of Flex. I've created my own version of Cairngorm that uses almost all of the features and classes described in the Cairngorm architecture.

      The biggest challenge for developing a Cairngorm architecture in Flash is that the architecturerelies heavily on Flex data binding to update the view when there are changes in the model. As far as I can find, there are no such capabilities built into AS3. This leaves me with a few not-so-desirable options. I could write my own data binding classes, or try to migrate the data binding classes from Flex. Neither of these options seem very desirable to me.

      For now, my quick soluton: each view class that can respond to changes in the model implements an "IBinded" interface that contains one function called modelUpdated. These classes register with a 'bind list' when they are instantiated, and any command that causes a change in the model also calls a function cycles through each registered view class, calling the 'modelUpdated' function to signify that the model has updated. This is a reasonable solution for a very simple application with very little model data, but as the application increases in complexity, it does not scale, because there is no way for a view class that is binded to an object in the model to know whether or not that object has changed - instead, EVERY view class that responds to changes in the model must check the current value of whatever objects they bind to and see if there has been an update.

      Obviously, a better solution is necessary. My question - does anyone have any ideas? Is there a way to use Flex's data binding in Flash? Perhaps there a better solution than data binding altogether?