It sounds like you're approaching the problem from a JavaScript style mindset, which isn't really the best way to go when dealing with AS3.
Without knowing more about your project or surrounding code, I'd suggest something along these lines: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ protected var vBox:VBox = null; protected function addVBox():void { if(!vBox) { vBox = new VBox(); vBox.styleName = "theBoxStyle"; this.addChild(vBox); } } ]]> </mx:Script> ... MXML code - possibly containing a component that calls addVBox()... </mx:Application> In Flex, the id parameter really only needs to be set explicitly when a component is created in MXML. In AS3, the explicit variable name is used. --- In [email protected], "Anthony Ettinger" <[EMAIL PROTECTED]> wrote: > > I want to dynamically create a VBox container for messaging from > ActionScript, however it's unclear to me how to check if one already > exists given its ID. > > var vBox:VBox = new VBox(); > > vBox.id = 'theBox"; > vBox.styleName = "theBoxStyle"; > > addChild(vBox); // here is where I want to check for getById('theBox') > in the DOM before adding a new one. > > > > > > -- > Anthony Ettinger > 408-656-2473 > http://anthony.ettinger.name >

