Written by

I have created a small file template for creating custom Event classes quickly and easily using IntelliJ IDEA. Simply go to Preferences > [IDE Settings] File Templates > Create a new template [click the + icon] > Name it i.e. ActionScript Event | Give it an extension i.e. as | enter the below script and your sorted. Now if you right click on your project and select New > ActionScript Event you can enter the couple of defined params and your done and dusted.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ${PACKAGE_NAME}#if (${PACKAGE_NAME} != "") #end{

import flash.events.Event;

public class ${NAME} extends Event {
    
    public static const ${CONST}:String = '${CONST}';
    #if (${eventObject} != "")
    public var ${eventObject}:${eventObjectClass};#end
    
    public function ${NAME}( type:String, 
                             #if (${eventObject} != "")
                             ${eventObject}:${eventObjectClass},#end   
                             bubbles:Boolean = false, 
                             cancelable:Boolean = false ) {
        super( type, bubbles, cancelable );
        #if (${eventObject} != "") this.${eventObject} = ${eventObject};#end 
    } 
    
    override public function clone():Event{
          return new ${NAME}( type,#if (${eventObject} != "") ${eventObject},#end bubbles, cancelable );
      }
}
}

Written by

I found this post unfinished in my drafts folder and I have no time to go into detail explaining the script as I previously would have liked, however, I have released the source and listed below are all the relevent aspects of the ANT build and classes. Looking at the source quickly to refresh my mind there are some useful elements there for (a) compiling modules, swf’s and swcs using ANT (b) module loading in PMVC using an external xml file (c) compiling and using all library resources into one library swc (whether good or bad).

At the tail end of 2009 I built an script for ANT which compiled a flex modular project and I wanted to build a demo around this script. Due to lack of time it’s taken a lot longer than I had hoped to wrap this up and to be honest I am sure there are areas that could be further refined. Essentially my main goals are achieved with this example, one of which being all the module swf’s are external projects in relation to the main application project.

Once again to save time I have not totally re-invented the wheel and have basically expanded Joel Hooks excellent application he uses in his blog post on the same topic, thanks for your approval for this Joel.

Read on →

Written by

In my previous post I mentioned using BindingUtils to update a View with data from a Model. One problem I found were my bindings within nested properties i.e. accessing a value within an Object in a Class, were not firing. The sequence would be model.data.selectedValue.value and setting up the binding in ActionScript I had used incorrectly:

1
2
// Incorrect
BindingUtils.bindProperty( view.my_txt, "text", model.data.selectedValue, "value" );

The correct way to approach this is to actually set a chain of bindable properties as String values within an Array.

A non-empty Array containing a combination of the first two options that represents a chain of bindable properties accessible from the host. For example, to bind the property host.a.b.c, call the method as: bindProperty(host, [“a”,”b”,”c”], …).

So the above correctly written would become:

1
2
// Correct
BindingUtils.bindProperty( view.my_txt, "text", model, ["data", "selectedValue", "value"] );

A small oversight that could easily be made.

Written by

This has been a topic I have wanted to mention for a while now, actually since my Combining the PureMVC StateMachine Utility with Slacker post as I use this particular logic in there. When I first used a MVC framework primarily PureMVC one of the concepts I toyed around with was different approaches for getting data from the Proxy to the Mediator. This decision is situation dependent so a simple one shoe fits all doesn’t apply here, but for the purposes of data getting updated in a proxy and the necessary requirement to ensure a Mediator gets informed of this change to the data you could:

  • Adhering to the PureMVC logic you could fire off a notification from your Proxy and register an interest in your Mediator passing the data as the notification body.
  • You could do the above but create an instance of your Proxy in the Mediator and directly access the data within a method triggered by an Event for example.

Here’s another suggested approach.

Read on →

Written by

I cannot count the amount of times I have had to use damn mx_internal in this project !@$%^ It’s been raised by many a developer that inaccessibility of certain properties in halo components is a grade A pain in the ar$e and I agree, Spark is already a vast improvement.

My latest was getting an mx:Form to layout horizontally, to do this simply create a custom class that extends form and stick this in the constructor:

1
mx_internal::layoutObject.direction = BoxDirection.HORIZONTAL;

Written by

This post is a mental note I needed to jot down as the specific logic could be something that people may get confused with or misinterpret as I previously have. This is my moment of clarity on the subject of linking external libraries using mxmlc, in my situation it’s within an ANT script.

The scenario is that you have one or multiple external libraries e.g. RobotLegs, PureMVC, Pipes, StateMachine to be included in your application, below are what I see as the core compiler options to be considered and explanations.

Read on →

Written by

I am very impressed with both Robotlegs and AS3Signals and have been itching to get to grips with combining the two of them. Joel Hooks has supplied a nice example in response to Elad Elrom with the Presentation Model. Using this as a reference I thought I would try and build a smaller simpler example application which brings in the Mediator again (although I am liking the PM example a lot).

I have built an example using the Flex 4.0 SDK and uploaded to Github. Thanks Joel for the support to cleanup mapping the Signal to Command in the Context class etc. I am sure there could be improvements made but I have really tried to keep it mega simple and just get the basics of dispatching and handling signals, it’s worked for me :)

Written by

In a previous post I highlighted how I found that certain styles where getting lost on my UITextField’s especially in renderers etc. I still noted people were finding this a continued issue and I have found a better way of handling this now which I have so far had 100% success with. Please see the code below:

Read on →

Written by

I have been developing a new example modular application recently which compiles using RSL’s and I have been working on an ANT script to build the bad boy. There were a few hoops I had to jump through and I got fed up with searching high and low for certain solutions so have decided to build a GitHub repository named Ant-Funk and upload my ANT scripts. Read the WIKI as these are to be used as a reference to help people getting started with building Flex applications using ANT. Also thanks to Pedr Browne who collaborated with me on some of these scripts and will be contributing more in the future!

Some of the tasks include: + Build custom wrapper using a SWFObject template. + Compile against RSL. + Compile a Library project to a SWC and extract the SWF to use as a RSL. + Compile’s module’s. + Launch HTML in a browser.

http://github.com/newtriks/Ant-Funk