tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/33-contextviewaddchild-is-not-available-in-this-class-instead-use-addelement-or-modify-the-skin-if-you-have-oneRobotlegs: Discussion 2018-10-18T16:35:07Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/8774142010-01-19T16:30:00Z2010-01-19T16:30:02ZcontextView.addChild: is not available in this class. Instead, use addElement() or modify the skin, if you have one.<div><p>Hey there,</p>
<p>first things, first: Great Framework! I really love your
approach.</p>
<p>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 4.0.0.13555 and
Robotlegs 1.0.1.</p>
<p>Some help would be greatly appreciated :)</p>
<p>Cheers,<br>
Alex</p></div>Alexander Jägertag:robotlegs.tenderapp.com,2009-10-18:Comment/8774142010-01-19T18:50:27Z2010-01-19T18:50:27ZcontextView.addChild: is not available in this class. Instead, use addElement() or modify the skin, if you have one.<div><p>Hi Alex<br>
The contextView in a command is a DisplayObjectContainer, and you
can’t use it directly to add children to it.</p>
<p>Try this:<br>
var myView:SkinnableContainer=contextView as
SkinnableContainer;<br>
myView.addElement(new Button());</p>
<p>You can use Object, or WindowedApplication, or Window, or what
else you need instead of SkinnableContainer.<br>
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:)</p>
<p>I hope it helps.<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/8774142010-01-19T21:27:47Z2010-01-19T21:27:51ZcontextView.addChild: is not available in this class. Instead, use addElement() or modify the skin, if you have one.<div><p>Hi Ondina,</p>
<p>works like a charms!!!</p>
<p>Muchas gracias!!!</p>
<p>Cheers,<br>
Alex</p></div>Alexander Jäger