Flex components cannot be added to the Stage.   You can add them to 
SystemManager and get pretty much the same effect.


On 9/22/11 11:56 AM, "Hogs Haven" <e_ba...@yahoo.com> wrote:






Thanks, but flash.display.Stage is not a Flex component; therefore it only has 
addChild(). addElement() is part of the spark Flex classes.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , 
grimmwerks <grimm@...> wrote:
>
> Try stage.addElement  rather than addChild?
>
>
> On Sep 22, 2011, at 2:30 PM, Hogs Haven wrote:
>
> > From everything I've read, Flex components can only be added to Flex 
> > Components (ie: VBox to Application, VGroup to Panel, etc)
> >
> > I'm working in an AS3 view library (no Flex, just Sprites) where I need to 
> > add a Scrollable container component to the Stage on a click event. There's 
> > no way to do this as I see it unless I write my own Scroll container, use 
> > Flex SDK (don't think this works), or use fl.containers.ScrollPane (which 
> > is not an option since we're not using a .fla)
> >
> > So basically, I'm trying to accomplish this, as simple runnable example, 
> > but it fails silently and nothing appears...any ideas? Thanks.
> >
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
> >    xmlns:s="library://ns.adobe.com/flex/spark"
> >    xmlns:mx="library://ns.adobe.com/flex/mx"
> > creationComplete="application1_creationCompleteHandler(event)">
> > <fx:Script>
> > <![CDATA[
> > import mx.containers.Panel;
> > import mx.core.UIComponent;
> > import mx.events.FlexEvent;
> >
> >
> > protected function 
> > application1_creationCompleteHandler(event:FlexEvent):void
> > {
> >      addEventListener(Event.ADDED_TO_STAGE, onAdded);
> > }
> >
> > private function onAdded(e:Event):void
> > {
> >    var myPanel : Panel = new Panel();
> >    myPanel.width="100";
> >    myPanel.height="100";
> >    stage.addChild(myPanel); //nothing happens
> > }
> > ]]>
> > </fx:Script>
> > <fx:Declarations></fx:Declarations>
> >
> > </s:Application>
> >
> >
> >
> >
> > ------------------------------------
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Alternative FAQ location: 
> > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> > Search Archives: 
> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
> >
> >
> >
>
> Garry Schafer
> grimmwerks
> grimm@...
> portfolio: www.grimmwerks.com/
>






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to