Friday, August 29, 2008
Adobe Certified Flex 2.0 Developer
Today I finally received the certificate of Flex 2.0 Developer from Adobe. I took the exam on 17 August 2008. The exam is not that simple, but you should find it easy to get a pass if you study those books introducing flex 2 and actionscript 3 well.
Sunday, August 24, 2008
Copying an ArrayCollection
There are multiple ways to copy an arraycollection ..
1. ac1 = ac2;
2. ac1 = new ArrayCollection (ac2.source);
3. ac1 = ObjectUtil.copy (ac2) as ArrayCollection;
Method 1 copy the ac by reference.
Method 2 will create an new ac instance, but the value (array) inside two ac are still the same.
Method 3 will create completely two different objects.
1. ac1 = ac2;
2. ac1 = new ArrayCollection (ac2.source);
3. ac1 = ObjectUtil.copy (ac2) as ArrayCollection;
Method 1 copy the ac by reference.
Method 2 will create an new ac instance, but the value (array) inside two ac are still the same.
Method 3 will create completely two different objects.
Dynamic source of Image control
In order to change the image source dynamically instead of creating multiple image instances, we could make use of [Embed] tag as follows:
[Embed(source="a.png")]
private var _src_a:Class;
[Embed(source="b.png")]
private var _src_b:Class;
_img = new Image ();
if ( ... ) {
_img.source = _src_a;
} else {
_img.source = _src_b;
}
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000968.html
[Embed(source="a.png")]
private var _src_a:Class;
[Embed(source="b.png")]
private var _src_b:Class;
_img = new Image ();
if ( ... ) {
_img.source = _src_a;
} else {
_img.source = _src_b;
}
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000968.html
Subscribe to:
Comments (Atom)