ActionScript
Introducing Aerial CMS
Apr 11th
Well, I finally let my irritation get to me… I’ve been developing Flash, Flex & AIR applications for two years now – most of them pulling data through AMFPHP from a PHP-based back-end. In those two years, I’ve tried nearly all the suggested solutions for managing content on the back-end and pulling it through to the front-end; Drupal, MODx, WordPress, Symfony. They are all fantastic PHP-based frameworks and systems, but they don’t allow me to develop applications the way I want to. So, as a consequence of this combination of irritation, frustration, egotism and flat-out boredom with writing the same code, over and over, for each project, I’ve decided to build a CMS – Aerial CMS.

What is Aerial CMS?
Aerial CMS (named Aerial because it was the first word i could think of with “RIA” in it) is a simple content management framework. I decided to rethink the concept of a content management system, because – the way I see it – CMSs these days are about content management AND content presentation. I think that these two massive areas of development & design need to stay very far away from each other. They are like brother and sister to us now, but sometimes – when stuck in a room together for so long – they breed and the results are disastrous (on top of being scandalous!).
Design Philosophy
Look at how the MVC (Model View Controller) pattern came about: software engineers found that separating application logic from presentation from data has serious design benefits. Now, i’m not attempting to bad-mouth all the incredible efforts of the CMS developers… I’m saying that for Rich Internet Application development, it really becomes a chore to use systems like Drupal or Symfony because they were not meant to be used in that way. They do what they do superbly well, but for RIAs they fail to impress me.
Aerial CMS has been built from the first line of code for optimized Rich Internet Application development. It focuses only on content management and development tooling, and wants nothing to do with how you present the data. It’s certainly a change from the standard model, and i’m convinced about how I want to develop my RIAs, but that’s why i’ve put out this early release – to see if you all agree with me. This CMS still has a very, very long way to go; it works well for most situations but the tools haven’t been developed yet.
Technology
Aerial has been built on two very well established and loved open-source frameworks, namely AMFPHP 1.9 and Doctrine 1.2.1. The Aerial framework is built for compatibility with PHP 5 only. Aerial enforces no rules upon you when you get down to developing your back-end code, but it does stick to Doctrine’s method of generating database tables and models. In essence, once you’ve set up your database schema, you can do whatever you like
you can plug into Doctrine’s API or you can write your own code; it really gives you the freedom to code the way you’re comfortable with.
Tutorials and Videos
I’ve made a Getting Started video to get you familiar with the framework and i’ll be writing a series of tutorialsĀ in the Wiki section of theĀ Google Code page for Aerial CMS. I’ve also got plans for a couple more video tutorials, so keep checking the site for updates or follow me on Twitter (@dannykopping).
Comments, Suggestions, et al
I’d love to hear what you have to say (as long as it’s in English – being monolingual sucks)! I’m very open to suggestions, any offers to help contribute would be welcomed and all constructive criticism is encouraged!
Working with the Security and SecurityPanel classes
Feb 5th
In a recent project, i was asked to build a system that would support storing cookies on a user’s local machine. This is obviously solved with SharedObjects if you’re working with the Flash Player. However, i ran into a few issues with this and found out a few interesting things.
Firstly, i wanted to detect if the user allows Flash/Flex to write to their computer. This can be solved as follows:
You can use the flush function of the SharedObject class… mySharedObject.flush(1) where 1 is the number in bytes that you require for your SharedObject. If the function returns a value of SharedObjectFlushStatus.PENDING, there is not sufficient space to store your SharedObject and a dialog appears that prompts the user to rectify this. If the function returns false, however, the user has not permitted using SharedObjects.
To call up a user’s Flash settings dialog (Camera, Display, Storage, Microphone, Privacy, Settings Manager), you would use the Security class from the flash.system package.
Integrating Flex, AMFPHP and CodeIgniter (also including Value-Objects)
Jan 5th
A few Tree tricks
Dec 2nd
The tree control in Flex is a very complex and somewhat complicated component at first glance, but with further inspection the complexity begins to melt away.
A few ballaches i have had when using Trees are:
- Automatic horizontal and vertical scrolling
- Static use of leaf and node icons
- Dynamic use of leaf and node icons
- Item event handling
Ballache 1 – Automatic horizontal and vertical scrolling
At first i thought that the Tree control’s lack of horizontal and vertical scrollbars – when content grew to beyond the component’s bounds – was a bug. Then i scolded myself for such heresy. The Flex developers would never leave such a common feature out or release a fucked up version of it. So i did a little research and found this post: http://frishy.blogspot.com/2007/09/autoscrolling-for-flex-tree.html.
Ryan offers a great hack that works almost perfectly, besides for the fact that the labelField gets screwed up and sometimes the text is snipped off a little at the end. At the bottom of the page is a solution:
change maxHorizontalScrollPosition = NaN;to maxHorizontalScrollPosition = 0;
change maxHorizontalScrollPosition = diffWidth; to maxHorizontalScrollPosition = diffWidth + 10; …or what ever correction factor you need.The user-submitted fix in combination with Ryan’s sub-classed AuoSizeTree file will allow you to have the horizontal and vertical scrollbars on “auto” mode.
Ballache 2 – Static use of leaf and node icons
This one is a sinch. All you have to do is use the folderOpenIcon and folderClosedIcon properties of your Tree and embed an image that will act as an icon. Same thing goes for leaves: defaultLeafIcon.
Ballache 3 – Dynamic use of leaf and node icons
This one is a bit more tricky. What you have to do here is define a “class” that will refer to an embedded icon:
[Embed(source='myIcon.png')]
private var myIcons:Class;
You can now use this icon as so (considering that you set the icon property of your Tree component to “@icon”):
treeDataProvider.appendChild(XML(“<testLeaf icon=\”" + getQualifiedClassName(“myIcon”) + \”" label=\”hello\”></testLeaf>));
What this will do is add a child to your Tree’s dataProvider and get the class’ qualified class name and use that as the icon in your leaf.
Ballache 4 – Item event handling
Want to handle click events for your Tree nodes/leaves? No problem! Set the itemClick property of your Tree to execute a function (clickHandler in this instance). When you click an item in a Tree control, it will call a function and pass it an event object of type ListEvent.
private function clickHandler(event:ListEvent):void
{
trace(event.currentTarget.selectedItem);
}
In the example above, the function is finding the selected item in your Tree control and tracing it out. If you’re using XML to define your Tree’s model, it will return an XML object which you can then type as XML. It’s really that simple!
Hope i’ve saved you a ballache or four
Flex 3.2, AIR 1.5, Flash Player 10
Nov 18th
Yesterday, Flex 3.2 was released, along with AIR 1.5 and numerous bug fixes to Flex Builder IDE and the data visualisation component architecture.
Click here to see Matt Chotin’s article which contains all the links for these goodies
A tip on using the Image component in Flex
Nov 14th
At some time in the future – if you’re using the <mx:Image> component in Flex – you will need to listen for an event that will signal the load completion of an image’s source. The Event.COMPLETE function doesn’t work, so you’ll have to use the FlexEvent.UPDATE_COMPLETE function. This will do exactly the same thing as using the Loader class, and using the following code: loader.contentLoaderInfo.addEventListener(Event.COMPLETE…).
SHA-1… broken?
Nov 8th
For many web developers – particularly those interested in security of data – the SHA1 hashing algorithm is a very neat and seemingly secure method of storing one’s passwords, etc. Although i do not claim to know that much about cryptography, the subject has always interested me. When reading my news feeds this morning, i saw that a new version of the as3corelib was released.
I then proceeded to scan the new featues, one of which is an HMAC implementation. This got me curious, since HMAC – as far as i understand it – works on top of SHA-1 or MD5 for example, and doesn’t bother with collisions. This also got me curious as to the progress of the cracking of the SHA-1 algorithm. So i googled it, and found this: http://www.schneier.com/blog/archives/2005/02/sha1_broken.html. Very scary stuff indeed. Then i looked at the date: February 2005
! Does anybody know the current state of the algorithm? Should we all start moving onto HMAC and SHA-256?
Acedia – apathy and laziness in the practice of virtue
Oct 12th
I am an admittedly lazy programmer and therefore, i hate doing manual “labour” with regards to coding. A perfect example of manual labour in coding is writing APIs. The toString() function kills me! I like to write my own toString() functions for enhanced debugging, but i couldn’t take it anymore. I’m working on a project in which the one class has 10 public properties and i refused to write a function that would put all 10 in a pretty, indented, explanatory format. So i began digging in the AS3 API and found this beauty…
describeType(value:Object):XML
In AS3, the for..in loop does not enumerate properties and functions declared by a class (thanks to Emmy Huang). What this means is that you cannot create a toString() function like this – which is what i’d hoped to do.
Instead, what you have to do is use the describeType function in your for..in loop instead of using this. However, the describeType function returns an XML layout of your class, so – for example – to enumerate all variables in the XML returned from this function, simply do this:
// enumerate variables in its own class
var variables:XMLList = describeType(this)..variable;
// enumerate variables from outside its class.
var variables:XMLList = describeType(getDefinitionByName(“MyClass”))..variable;
Then, with the variables XMLList, you can loop for all variables in your class, do whatever you like with them, and know deep in your heart that you’re such a lazy fucker
Community efforts
Sep 12th
I’m a very investigative programmer in that i’m always looking for packages that will make my life easier, my application more vibrant or more exciting, or my ideas come alive. Below is a list of incredible packages developed by the community and are free for usage (but be sure to check the licences individually for any fine print).
RSS/Atom
as3syndicationlib – an excellent package for reading all RSS/Atom specifications, or using the generic parser.
Tweening
TweenLite, TweenFilterLite, TweenMax (not MaxTween, Neil
) – amazing trio!
Caurina’s Tweener – probably the simplest Tweening engine i’ve come across
gTween – looks promising, haven’t tried it yet, though.
3D
Sandy3D – by far, the best documented and well-designed 3D engine i’ve come across.
Papervision – apparently the 3D package, but there are very few tutorials. If anybody knows of some, let me know.
Alternativa – built by a bunch of crazy Russian coders… Ridiculously impressive, difficult to use.
Utilities
as3corelib – A collection of handy utilities for encryption (SHA1, MD5), encoding (JPG, PNG), and a myriad of other useful bells and whistles.
Cryptology
as3crypto – An incredible package for encrypting and decrypting your data using everything from MD2, LZW and RSA.
Database Interaction
asSQL – A package for connecting to a MySQL database directly from ActionScript 3.0!
Frameworks
PureMVC – my personal favourite… Brilliant framework!
Cairngorm – a good (albeit difficult and clunky) framework developed by Adobe
Mate – a tag-based framework… Looks good, haven’t tried it yet
Components
flexlib – great collection of components for usage in Flex
Site-related APIs
Physics
Remoting/Webservices
amfphp – the godsend.
WebOrb – fantastic effort by themidnightcoders… ports for many languages
External Resources
Metadata
metaphile – a package for reading and writing metadata of common filetypes
Hope this is useful!
—–
Danny



