>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>


Reply via email to