Parsley 2 basic flex example

05 Jul 2009
Posted by admin

[Update] After some comment by Jens (Parsley dev) i updated the workflow. See striked comment below [/Update]

This is a _very_ basic example of the new Parsley framework version (2.0).
Although useless and ugly :), it uses a few of Parsley new features such as injection via metadata and the messaging capabilities (read event system).
If you haven't given it a try... you should!

Right-click for source (or see it here)

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

(Did i say it was useless?)

A few explanations:
- on the structure:
Obviously there are easiest ways of getting the same result, the goal here is to demonstrates the use of a basic MVC structure using Parsley.
I didn't use a Mediator/PresentationModel as it wouldn't add anything new to show.

- on the workflow:
Beans.mxml is the context file which defines the main elements.
It is loaded by the base Application (Parsley2Flex.mxml), which dispatches a custom ON_APPLICATION_COMPLETE event.
With the use of some metadata (see Parsley2Flex.mxml), this event is managed by the Parsley message system, and handled by the controller (see Controller.as).

The controller uses Parsley MetaData [PostConstruct] to react when context is ready.
It then calls methods on the Model (injected by Parsley, see Model.as) and the view uses bindings to react to the model changes (see Main.mxml)

oh! and it logs to SOS console using S.Rohde extension, which makes the whole thing very easy.

Here you can find more or less the same example built on flash (ie. not flex). I really like the fact that Parsley is not flex only, so depending on your requirement you can choose which way to go...

Tags:  | 

Comments

Line 35 of Parsley2Flex.mxml should read:
// INITIALIZE PARSLEY
FlexContextBuilder.build(Beans,this);

Davorian (not verified) | Jan 11th, 2010 at 6:43 pm

This is a very nice example to demonstrate the flow of parsley's application framework. This example works with parsley 2.0 swc but not with the latest version of parsley.

krishnan (not verified) | Dec 14th, 2009 at 11:53 pm

true.. i need to update those examples

admin | Feb 23rd, 2010 at 4:06 pm

thanks. i think it IS view source enabled. Anyway, i added a link too.

admin | Aug 17th, 2009 at 11:45 am

Nice work dude,
but you forgot the view source.

Regards

ketut (not verified) | Jul 28th, 2009 at 3:36 am

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options