3 Replies Latest reply on Nov 8, 2008 10:42 PM by ilikeflex

    copy of a viewstack

    dnbwise
      I want to create a viewstack and copy the contents of another viewstack into it. i.e.

      viewStack:ViewStack = new ViewStack();
      vs:ViewStack = new ViewStack();

      /*add some display objects to vs*/
      vs.addChild(displayObject1);
      vs.addChild(displayObject2);
      .
      .
      /*copy vs into viewStack*/
      viewStack = vs;


      so why doesn't this method work?



        • 1. Re: copy of a viewstack
          Level 7

          "dnbwise" <webforumsuser@macromedia.com> wrote in message
          news:gb0sga$5qb$1@forums.macromedia.com...
          >I want to create a viewstack and copy the contents of another viewstack
          >into
          > it. i.e.
          >
          > viewStack:ViewStack = new ViewStack();
          > vs:ViewStack = new ViewStack();
          >
          > /*add some display objects to vs*/
          > vs.addChild(displayObject1);
          > vs.addChild(displayObject2);
          > .
          > .
          > /*copy vs into viewStack*/
          > viewStack = vs;
          >
          >
          > so why doesn't this method work?

          Because you only have one ViewStack with two variables pointing at it.

          HTH;

          Amy


          • 2. Re: copy of a viewstack
            dnbwise Level 1
            not sure i follow u. one thing that I left out that...viewStack is instantiated using mxml as follows:

            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" applicationComplete="onApplicationComplete()">

            <mx:Script>
            <![CDATA[

            onApplicationComplete():void {
            var vs:ViewStack = new ViewStack();
            vs.addChild(DisplayObject1);
            viewStack = vs; /* where viewStack is defined below*/
            }

            ]]>

            </mx:Script>
            <mx:ViewStack id="viewStack" width="100%" height="100%"/>
            </mx:Application>
            • 3. Re: copy of a viewstack
              ilikeflex
              Did u get answer to this question?