[Pixlib] rev30

Francis BOURRE peterphonix at usa.net
Thu Mar 16 11:25:29 EST 2006


Another revision with additions and changes.

- Model class added to provide ModelLocator in pixlib api.
- XMLToObjectSerializer class added to serialize object state to xml data.
- XMLToObjectDeserializer.DEBUG_IDENTICAL_NODE_NAMES added to get less verbose
logging during parsing.
- Minor fix on MovieClipHelper in _setName method for better debugging.
- AbstractTween.setDuration method added.
- Config quick fix to filter prototype property logging while __resolve
access.

The greatest additions are :
- XMLToObjectSerializer made by Romain Carnot. Big thanks to him for this 1st
(but not last I hope) great contribution to pixlib sourcecode. See
documentation to understand how to use it.
- Model class which introduces ModelLocator (ala Cairngorm or Arp with imho a
more intuitive approach). As you know that's pretty clean to give to the model
the whole responsibility to update the view through event process (no couplig
beetween view or viewhelpers and concrete commands). That's the result of a
long discussion with aral at spark.


To finish, here's a quick demo of Model class use:
import com.bourre.core.Model;
import com.bourre.events.EventType;
import com.bourre.events.NumberEvent;

class tests.ModelTest 
 extends Model
{
 public static var onValueChangeEVENT : EventType = new
EventType("onValueChange");

 private var _n : Number;
 
 public function ModelTest() 
 {
  super("modeltest");
  _n = 0;
 }
 
 public function setValue( n : Number ) : Void
 {
  _n = n;
  notifyChanged( new NumberEvent( ModelTest.onValueChangeEVENT, n ) );
 }
}

//
        var m : ModelTest = new ModelTest();
        Model.getModel("modeltest").addEventListener(
ModelTest.onValueChangeEVENT, this, _onValueChange );
        ModelTest( Model.getModel("modeltest") ).setValue( 3 );
    }
    
    private function _onValueChange( e : NumberEvent ) : Void
    {
     Logger.LOG( ">> " + e.getNumber() );
    }

Enjoy,

francis.





More information about the Pixlib mailing list