Hi all,

I researched my attempts to create a Dynamic ViewStack yesterday and I
think I am on the right track, although I can't get anything to
display  and I am facing an error. 

Here is the error message I receive:
"Type coercion failed. Cannot convert []34a56 to DisplayObject."

Basically, I have created 3 simple views for my testing purposes. Each
is a Canvas with a label on it. They are named SampleScreen,
SampleScreen02, and AdminScreen. 

In the final implementation I will load the appropriate screens into
an Array and loop over the array. The screens I load will be based on
the type of user. So an admin will see different screens than a web user.

This is the code I have come up with. It's very basic just to try and
achieve my goal.

START--Samples.mxml--

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="init()">

<mx:Script>
        <![CDATA[
                import mx.states.AddChild;
                public var sampleScreen:SampleScreen = new SampleScreen();
                public var sampleScreen02:SampleScreen02 = new SampleScreen02();
                public var adminScreen:AdminScreen = new AdminScreen();
        
                public function init():void{
                        var screenArray:Array = new Array([sampleScreen, 
sampleScreen02,
adminScreen]);
                        for(var i:Number = 0; i < screenArray.length; i++){
                                var addChild:AddChild = new AddChild();
                                addChild.relativeTo = desktopViews;
                                addChild.target = DisplayObject(screenArray[i]);
                        }
                }
        ]]>
</mx:Script>

        <mx:ButtonBar dataProvider="{desktopViews}" left="0" top="0"
width="100%"  height="30"/>
        <mx:ViewStack id="desktopViews" width="900" height="600" left="0"
top="30" />
        
        
</mx:Application>
END--Samples.mxml--

Thank you so much if you could be of any help.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to