Tuesday, November 4, 2008

PureMVC : Basic PureMVC with SWFAddress sample (Flex)


What's now?

- just another lazy PureMVC sample!, skip this if you already known :)

OK, go on

- well i just start trying PureMVC, many peep said it's good, so...it's worth to try right? after googling i found some best practice for cave man like me here

Why SWFAddress?

- why not? :P grab it here http://www.asual.com/swfaddress/
- and don't forget http://puremvc.org/component/option,com_wrapper/Itemid,144/

And then?

- i think hubflanger sample is cool and well describe but it's not have SWFAddress yet and you need Flash IDE there, so let's mod it for practice yourself (also me ;P)

Result?

- 11kb file size for basic site navigation! minimalist again, lol nice!
- and now Flex peep can compile this hubflanger sample with Action Script Project, so you can happy with as3 there, but i'm not big fan of mxml, feel free to add it yourself there, then it's just working with out beauty ;)

image

- view here :http://sleepydesign.com/labs/as3/PureMVC/PureMVCSWFAddress/
- source here : http://sleepydesign.com/labs/as3/PureMVC/PureMVCSWFAddress.zip


And then?

- only one thing that i''ve to mention is "public static var currentSection:String;" in "NavMediator", for call later by "SWFAddressProxy.setTargetURI(uriSegments:Array)" for check already focus section there to avoid recursive call, it's maybe need "get/set" here instead of "public static var" cause "NavMediator.onNavButtonPressed" also sent notification this too, can be conflict later, but i'm feeling lazy now so just leave it there and let's you make decision to change it or not ;)

Next?

- i need Web Service rpc soap for next project somehow, so let's do it minimalist way, someone boring yet? lol not me....happy coding!

2 comments:

Anonymous said...

One question. Should not the first recording proxies before the Mediators? In StartupCommand

Anonymous said...

This framework doesnt work at all.

These 3 lines dont work and throw errors:

var data:Object = _siteDataProxy.getData();
var vo:SectionVO = data[ s ];
var content:XMLList = vo.content;