background preloader

ActionScript

Facebook Twitter

Parsley Framework Basics. After studying the Parsley framework lately, I obviously decided to created a mini-application to learn the basics of how the framework operates. And I've decided to share that here. Some concepts like custom Events and Commands will seem familiar if you have used the Cairngorm framework in the past. Note: Some code omitted for brevity. Creating View and Presentation ModelOur mini-application will simply display a list of Contacts in a DataGrid that is loaded from a remote source. So the next step is to create the Presentation Model class called ContactsPM. Public class ContactsPM extends EventDispatcher {[Bindable]public var contacts:ArrayList; public function search():void {}} The last part is to go back into your MXML view file (Contacts.mxml) and add two things.

[Inject][Bindable]public var model:ContactsPM; The [Inject] metadata tag will be used by Parsley to set an instance of the class when the framework initializes. Next we need to create the GetContactsCommand class. Inversion of Control and Dependency Injection with Flex using the Parsley Application Framework – Part 2 | Building Blocks. This is the second part in a series exploring Inversion of Control and Dependency Injection containers available for Flex. In the first part of the series we discussed what IoC and DI are and how they can benefit our applications. In this part, we will explore the Parsley IoC Container through a simple image gallery application. Here’s the source on github… The above is a simple image gallery that is grabbing the top 100 ‘interestingness’ images from Flickr.

It is built with Flex 4 and uses a mix of halo components (the images) and spark components for layout. Less talk. One aspect of an IoC/DI container that is consistent across frameworks is the need to bootstrap the configuration. From the docs: Configuring and initializing the Parsley Framework usually consists of the following steps:Step 1: Telling the IOC Container which classes it should manage. In the image gallery sample step one is accomplished in Beans.mxml. Beans.mxml ParsleyGallery.mxml: DisplayGalleryAction.as: GalleryView.mxml. Jacob Schatz » Blog Archive » Getting started with Parsley Framework with Flex. Apparently it’s hard to find straight up docs on how to set up Parsley. And frameworks can be confusing. And really you shouldn’t use them in production if you aren’t really comfortable with them. Otherwise you just make a big mess.

Ok enough preamble. Going try and make this as easy as possible. Set up Flex: Go here to download the zip. Unzip it parsley-2.3.2.zip (version as of this writing). In my example I will be using Flex 4. In the folder you will need 2 swcs - (your version might be different). (again version might be different). Open up Flex (3 or 4) Make a new Project (File->New->Flex Project) For Project Name: For Application Type: Web (runs in Adobe Flash Player) Click Next (don’t click finish yet) Click Next one more time It’s now time to add the SWCS we talked about before Click Click Browse and navigate to (or for flex 3. Click Open Click again Click Browse and navigate to (Again version may differ) Click Finish You have now successfully set up Flex.

Programming a Sample App 1. Basic Parsley Framework Flex Example Explained | Lon (Alonzo) Hosford's Bitbox. I decided to break down the Parsley framework for Flex and Flash projects. This is my own minimalist example. I am not going to extol virtues or evils with using Parsley and assume you just want to get a basic example that explains the pieces. This does not tie into web server but I added a basic example that uses Zend AMF, PHP, MySQL, Flex Remote Objects.

Also if you want to look at a very basic Flash Actionscript example see Parsley Hello World For A Flash Builder Actionscript Project. It was hard to find a good minimalist starter example that takes the time to explain the details. The best I have found is Arturo Alvarado’s posts at Art’s Flex Notes. The “Hello World” getting started example in the Parsley documentation is also a great starting point except there is no explanation outside of comments to soothe your into it. My example focuses on the main structure and foundational features in Parsley. Learn More About Flex 4 From Adobe Flex Builder 4 Flex Project. Inversion of control in Flex using Parsley framework. Inversion of Control (IOC) is one of a design strategy that has become popular in software development over the last few years, if you are from Java or .Net ecosystem then you must have heard about it. So what is the IOC? In a nutshell, IOC is an approach in which a separate object is responsible for populating the fields of other objects with correct implementations, instead of these other objects being responsible themselves.

There is a good reason for this, since this approach decouples the objects of an application, so they can change independently of one another and be tested in isolation. If you want to know more about this check the following Parsley Parsley is an application framework for Flex/Flash/AIR applications written in AS3. And much more… Basic Parsley configuration There are three basic steps to Parsley configuration:1.Create a Config.mxml file 2.

Sample Application. Quick Dive into Parsley (Intro - Why Parsley? - Part 1) This is a series of articles that should help you get you up and running with Parsley quickly. It starts with the basics and moves up to more advanced features. If you are new to Parsley or with to find out how to use Parsley in and MVC implementation, you came to the right place. Why Parsley? A little background on how and why we chose to use Parsley in our projects. I'm a developer who ran into Flex some years back and fell in love with it. As usual, the quest for finding better ways of doing things is always on, and as projects grow in size this becomes even more important. Now MVC is a pattern, not a framework. A lot of people will bash Cairngorm for some of the ways it handles things, particularly for its implementation of the ModelLocator.

A simple example: Let's say that you have an application that allows users to Log In. That said, the main reasons we decide to leave Cairngorm follow: Cairngorm is heavily dependent on binding, which is useful in many cases but can get annoying. Flash remoting for PHP: A responsive Client-Server Architecture for the Web.