The Nordhagen

  • Home
  • LazyFallback
  • BindMax
  • Olog
  • About me
Browsing: / Home
Shortlink

BindLite gets a big brother

By Øyvind on Monday, November 21, 2011 in Adobe Flash, BindLite, Freebies

Well not exactly bigger in terms of file size, but since BindLite was taken it had to be BindMax for its brother. BindLite was released earlier this year as a flex-less, event-less alternative to data binding in AS3. But whereas BindLite is a static class suitable for smaller projects, I quickly realized that to make it more usable, it could no longer be all static. Enter BindMax.

BindMax does exactly the same as BindLite does but with the added flexibility of being an instance. The recommended approach is to extend it for your Model class. Example:

public class MyModel extends BindMax {
	public var state:String = State.INPUT;
	public var captureDelay:uint = 0;
	public var capturePhase:String;
	public var currentSwf:SwfVO;
	public var error:ErrorVO;
	public var render:BitmapData;
}

This is all you need for BindMax to do its magic. Your model class need no additional code, not even a constructor. As the superconstructor is implicitly called, BindMax will auto-enumerate all public variables and accessors as bindable with the correct data type for you. Explicitly calling the superconstructor lets you set the autoEnumerate argument to false if you wish to prevent this behaviour.

After this, all is the same as with BindLite with the exception that you need access to the MyModel instance. I recommend providing this acces through a dependency injection-driven framework such as RobotLegs.

Examples of use:

// Binding a property to a public property or setter on view
model.bind( "state", view );

// Property name needs to be passed as string, so using enums is recommended
model.bind( Bindable.STATE, view );

// Changing a property and propagate the change if value is different
model.update( Bindable.STATE, "main" );

// Changing a model property and force propagation
model.update( Bindable.STATE, "main", true );

// Resetting model properties to their values at define time
model.reset( Bindable.STATE, Bindable.FILE );

// Removing a data binding. Omit the second argument to unbind target from all data bindings
model.unbind( view, Bindable.STATE );

// Retrieve the before-change value of a bindable property
model.retrieveLast( Bindable.STATE );

// Control what happens when last target unbinds from a property
// true : Discard orphaned bindings
// false : retain orphaned bindins (default)
model.autoDisposeBindings = true;

Download BindLIte and BindMax as a combined package here: http://code.google.com/p/bindlite/

Docs are here: http://www.oyvindnordhagen.com/bindlite/docs/

Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Circular Tron pattern generator

By Øyvind on Monday, October 31, 2011 in Adobe Flash, Freebies

Just as part of a fun little side project, I made this class to generate random circular Tron-like patterns. I thought I’d post it here in case anyone else likes the look of what it does. I’ve included an option to save the image in 2880×2880 pixels.

Se the Tron pattern generator here: www.oyvindnordhagen.com/tron/

Share this on: Mixx Delicious Digg Facebook Twitter
Shortlink

Freebie: IPScanner

By Øyvind on Wednesday, September 21, 2011 in Adobe Flash, Freebies, Problems & Solutions

IPScanner doing its job through Olog

So these days I’m experimenting with AIR P2P apps through the recently introduced ServerSocket class (which I think is still in beta by the way). Since the AIR API does not provide any network client/server/peer discovery tools, I decided to hack down a simple IP scanner to do the trick.

This package consists of two classes; IPScanner and IPScannerEvent. IPScanner will accept a starting IP and it will scan the rest of the range from that IP. In other words, if you pass in 192.168.1.100, it will try to “ping” each possible address from 192.168.1.100 to 192.168.1.255. Pass in 192.168.0, and it will go on all the way from 192.168.0.0 to 192.168.255.255, but it is limited to those last two segments.

An optional handshake string can also provided. In which case IPScanner will attempt to send this handshake string to each IP it is able to connect to and wait for a reply. This enables you to make sure you’re connecting to the right peer.

I find this works really well for me, so I thougt maybe someone else might need it too. Feel free to leave comments!

IPScanner.zip

Share this on: Mixx Delicious Digg Facebook Twitter
« Previous 1 2 3 … 25 Next »

Search

Twitter

    Flickr

    Friends

    • Ballesparket
    • Christine Nygaard-Andersen
    • Haje’s Writings (Haje Jan Kamps)
    • Hastalasiesta (Martin Jacobsen)
    • Knut Nordhagen
    • Martin Jacobsen
    • Photocritic (Haje Jan Kamps)
    • The Montreal Twang (Thomas Wangsmo)

    Copyright © 2012 The Nordhagen.

    Powered by WordPress and News.