contextView.addChild: is not available in this class. Instead, use addElement() or modify the skin, if you have one.

Alexander Jäger's Avatar

Alexander Jäger

19 Jan, 2010 04:30 PM

Hey there,

first things, first: Great Framework! I really love your approach.

As I wrote in the Subject Line, i am trying to add a Skinnable Component from within an Command to the Application, which results in the supplied Error. I am working on Flex SDK and Robotlegs 1.0.1.

Some help would be greatly appreciated :)


  1. Support Staff 1 Posted by Ondina D.F. on 19 Jan, 2010 06:50 PM

    Ondina D.F.'s Avatar

    Hi Alex
    The contextView in a command is a DisplayObjectContainer, and you can’t use it directly to add children to it.

    Try this:
    var myView:SkinnableContainer=contextView as SkinnableContainer;
    myView.addElement(new Button());

    You can use Object, or WindowedApplication, or Window, or what else you need instead of SkinnableContainer.
    Other than that the error comes from the fact that you are using spark visual elements, that don’t have the addChild method. So as it says in the error message: use addElement instead:)

    I hope it helps.

  2. 2 Posted by Alexander Jäger on 19 Jan, 2010 09:27 PM

    Alexander Jäger's Avatar

    Hi Ondina,

    works like a charms!!!

    Muchas gracias!!!


  3. Shaun Smith closed this discussion on 25 Jan, 2010 12:21 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac