Here’s a quick tip for those of you who are also switching to Flex 4.x/Flash Builder 4 from Flex 3.x/Flex Builder 3. In the past when you wanted to add a Flash DisplayObject to the main Application canvas you’d wrap the DisplayObject in a UIComponent, then add the UIComponent to the Application as a child, like this:
var sprite:Sprite = new Sprite();
var ui:UIComponent = new UIComponent();
ui.addChild(sprite);
this.addChild(ui);
Try that in Flash Builder 4 and you’ll encounter a fun error that looks like this:
Error: addChild() is not available in this class. Instead, use
addElement() or modify the skin, if you have one.
To resolve it, simply change the last line of the previous code to use addElement() instead (change in red):
var sprite:Sprite = new Sprite();
var ui:UIComponent = new UIComponent();
ui.addChild(sprite);
this.addElement(ui);
This is such a great resource that you are providing and you give it away for free. I enjoy seeing websites that understand the value of providing a prime resource for free. I truly loved reading your post. Thanks!
Nice post and this mail helped me alot in my college assignement. Thank you as your information.
Thanks Luka. It helped me alot.