Archive for Actionscript 3.0
How to write custom LayoutComponents
November 28th, 2008 • AS3-Layout-Framework, Actionscript 3.0
To write custom ILayoutComponents or ILayoutContainer, there is just one method (processLayoutEvent( type: int, c: ILayoutComponent )) that needs to be overridden to handle layout events. This method will be invoked internally by a ILayoutComponent after ILayout implementations changed the position, layout bounds or the cropped size.
Read more »
The FlowLayout
November 21st, 2008 • AS3-Layout-Framework, Actionscript 3.0
A FlowLayout arranges ILayoutComponents in a row until no more ILayoutComponents fit in that row. The ILayoutComponents will be arranged to their preferred size and therefore won't be cropped.
In addition the FlowLayout offers the possibility to choose different style settings which are also modifiable at runtime.
Read more »
The GridLayout
November 16th, 2008 • AS3-Layout-Framework, Actionscript 3.0
The GridLayout implements ILayout and is therefore responsible for layouting ILayoutContainers.
It lays out all ILayoutComponents of a ILayoutContainer in a rectangular grid, which means that all ILayoutComponents will be positioned in equal-sized rectangles.
Read more »
How to use the AS3-Layout-Framework
November 9th, 2008 • 11 comments AS3-Layout-Framework, Actionscript 3.0, Design Patterns
The AS3-Layout-Framework is basically very simple and easy to understand. It is based on one structural (Composite) and one behavioural (Strategy) pattern.
The composite pattern is used to compose objects into tree structures to represent part-whole hierarchies. Also it has the advantage to let clients treat individual objects and compositions of objects uniformly[GHJV95]. While updating all ILayoutComponents, a ILayoutContainer ( extends ILayoutComponent) lays out its subcomponents and a simple ILayoutComponent just handles its bounds ( Figure 1 shows the inheritance structure of the participants in more detail ).
The strategy pattern is used to encapsulate algorithms in objects with a well formed interface and lets the algorithm vary independently from clients that use it[GHJV95].
In the AS3-Layout-Framework the ILayout embodied the strategy pattern. This makes the creation of concrete layouts very simple and easy to plug in (f.e. GridLayout, FlowLayout).
Read more »
Actionscript 3.0 Layout Framework
October 26th, 2008 • AS3-Layout-Framework, Actionscript 3.0, Design Patterns
During the last weeks I worked on an layout framework for actionscript 3.0 in my free time. I thought I would get some inspiration from the JAVA layout framework, and yes I got it.
Unfortunately the layout framework itself was overengineered and was not totally fulfilling my conceivabilities.
I just wanted a layout framework which is easy to extend, lightweight and fast with interfaces flexible enough for be used in other solutions( f.e. drag and drop).
Read more »
Addicted to MicroObservables
August 26th, 2008 • 2 comments Actionscript 3.0, Design Patterns
Very often it is necessary to use an obervable-pattern in its basic structure, which means that the observable notifies registered observers after its internal state has changed.
This implementation concept is very static and has the side effect that the observers are notified every time the model has changed regardless of which change they are interested in.
In this case it is recommended to use a more dynamic approach like an specific observable.
But if you only have one value in the model which changes, the MicroObservable structure could be very useful. Read more »
LoaderQueue with strategies
August 25th, 2008 • Actionscript 3.0, Design Patterns
With the loader queue it is easy to load data (f.e images or xml) application wide in a priority queue. This version uses encapsulated ILoader implementations and is therefore easy to extend.
The loader queue has the following tokens:
In addition it is possible to parametrize the loaded data with an anchor that could be of any type. This is very useful when images belong to specific objects (see code example).
For a new need of a loader implementation a programmer just had to write a new specific loader strategy that implements ILoader.
Basic implementations like a Loader and a URLLoader for loading Loader and URLLoader specific data can be found in the addicted2flash library. Read more »
How to use AS3-Collection-Framework
August 17th, 2008 • AS3-Collection-Framework, Actionscript 3.0
There are different types of data-structure present in the AS3-Collection-Framework. Each of it has it's advantages and disadvantages. So before using it, it's recommended to first think about the requirement. Read more »
Lazy is not always bad…
August 5th, 2008 • Actionscript 3.0, Design Patterns
Lazy data-structures are structures that could be requested and are therefore not necessary loaded at request time.
Besides "lazy" data retrieval another important aspect of these data-structures are often the possibility to cache executed requests. To reduce http-requests on server-side it's necessary to cache the results of former requests on client-side.
To solve this problem a data-structure must be created on which specific ranges can be requested. Configured with a specific page size, data can be loaded with a constant size and requests therefore easily be cached. Read more »
Advantages of collection based data-structures
August 5th, 2008 • 1 comment AS3-Collection-Framework, Actionscript 3.0
In many situations programmers are forced to manipulate data structures.
These could be indexed based retrieval of data as well as sequential followed traversing. These structures are coded at least a hundret times in different projects.
To follow the fundamental thoughts of object oriented programming, there necessary has to be a common data-structure that ensure the maintainability and reusability of software.
Collection classes such as sets and lists are ideal candidates for software reuse and can therefore play an important role in object-oriented class libraries[EMKS98]. Read more »
Recent Comments