The lifecycle package of AS3Commons UI solves the problem of creating and updating visual components in a comprehensible, structured and performant way.
Read the LifeCycle introduction to get familiar with the meanings of Invalidation & LifeCycle.
The package contains two services (Invalidation and LifeCycle), of which Invalidation is an abstract and customizable invalidation manager and LifeCycle is a configuration of the first and provides a ready-made component life cycle. Both take use of the following workflow pattern:
If you know Flex, Invalidation is an alternative to the Flex LayoutManager, LifeCycle is an alternative to the entire Flex component life cycle.
You use I10N when you are planning to create your own custom component life cycle. You use LifeCycle when you right away want to start developing performant components.
What is invalidation?
Invalidation is an asychronous design pattern in which the setting of a property is decoupled from the actual visual update of a component. Properties may change concurrently and multiple times. The visual update is yet executed only once.
The pattern requires the existance of an update scheduler. Whenever a property changes, the component schedules a visual update. After an amount of time (often at the end of the current frame) the scheduler is triggered and processes all objects added.
Having an invalidation service your component could use the following implementation to delay expensive visual updates:
private var _property : String;
private var _property2 : String;
public function set property(property : String) : void {
_property = property;
InvalidationService.invalidate(render);
}
public function set property2(property : String) : void {
_property2 = property;
InvalidationService.invalidate(render);
}
private function render() : void {
// apply some drawings
// layout children
}
}
What is a component life cycle?
A life cycle is a convention of how components are created, initialized, drawn, updated and disposed. A life cycle takes use of the invalidation pattern to organize visual component updates. Additionally, the life cycle manages all the other aspects.
Using a life cycle will:
- help you to add functionality to the right places
- increase the performance of your component
- reduce the amount of code you need to write
- let you feel your components are well implemented
Having a component life cycle system you usually create a component from a base class that implements all necessary life cycle methods:
private var _property : String;
public function set property(property : String) : void {
_property = property;
super.invalidate();
}
override protected function init() : void {
// set up event listeners
// set default values
}
override protected function createChildren() : void {
// create child objects
}
override protected function render() : void {
// apply some drawings
// layout children
}
override protected function dispose() : void {
// remove event listeners
}
}
What is Invalidation & LifeCycle?
A component life cycle is a core part of every component framework. The best-known life cycle implementation is the Flex component life cycle with its familiar methods invalidateProperties(), invalidateDisplayList(), createChildren(), updateDisplayList(), ....
Any life cycle has its custom implementation of the invalidation pattern. Nevertheless, this is a very common problem that can be easily generalized. The Invalidation manager of this package (I10N) is such a generalization. You can use and configure I10N and put your own life cycle around. I10N is configurable to a large extent and fits to any need.
The LifeCycle system is made for those, who don’t want to spend time in creating their custom component life cycle. It’s a ready-made and out of the box usable system.
Invalidation (I10N)
I10N is a phase based validation manager for visual components. Once registered a component may schedule updates to a later date and will then be notified automatically at the time the update should be executed. You typically use I10N not directly but you customize the system to create your own component life cycle. The chart below shows the workflow of I10N. Click to enlarge.
See the Invalidation documentation for detailed information and usage examples.
LifeCycle
LifeCycle is a ready-made component life cycle built around a configuration of I10N. You simply plug in LifeCycle into your components, and you will get a clean and reliable component state management. The chart below shows a simplified workflow of LifeCycle. Click to enlarge.
See the LifeCycle documentation for detailed information and usage examples.

RSS







9 Comments
_wqu
Great work!
I’will try to use it in my next project.
bFunc
LifeCycle really looks useful, it’s what I was thinking about for a long time.
But I have different kinds of troubles when trying to integrate lifecycle into my project.
for example, I just changed package name in
BoxLifeCycleExample.as and then got
[Fault] exception, in Invalidation.as line 291: information=ReferenceError: Error #1069: Property org.as3commons.collections.framework:IBasicMapIterator::key not found on org.as3commons.collections.framework.core.LinkedMapIterator and there is no default value.
Jens Struwe
You need to include AS3Commons collections 1.3. This should solve the problem.
bFunc
tnx a lot, u r right. Update solved the problem
Matt
This library looks great… except for the silly naming, which is probably reason enough for me to NOT use it. Naming is important, especially in a library.
Please consider changing your “clever” naming for the invalidation portion of this library (“I10n”). In the age of intellisense editors, it doesn’t help typibility, and severely hurts readability because it looks too much like the existing “l10n” moniker (commonly used as an abbreviation for “localization”). I’m not a fan of the common “l10n” (or “i18n”) namings either, but at least they are well-known.
“i10n” is just confusing — “invalidation” would be a much better name.
Jens Struwe
Thanks for the suggestion, Matt. I always love to read your issue reports and comments.
The naming I10N is not as “clever” as you might think. An earlier version of Invalidation was implemented as a static utility where you had to operate extensively on the class name instead of an instance name of your choice. Shortening the class name was a compromise to keep the client code cleaner and more readable.
Nevertheless, I understand your problem and will consider a re-renaming for a future release.
By the way, could you recommend alternatives to this library to all of those people who also do NOT use it because of the annoying wording?
oral health
I do not even understand how I stopped up right here, but I
assumed this put up was good. I don’t understand who you’re however certainly
you are going to a famous blogger for those who are not already.
Cheers!
behavior dog training
Howdy! This is kind of off topic but I need some help from an established blog.
Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about creating
my own but I’m not sure where to start. Do you have any tips or suggestions? Thank you
how to lose weight
I am truly thankful to the holder of this web page who has shared this fantastic post
at here.