views:

33

answers:

1

Hi,

My application has a number of identical AS3 class instances:

var Pan1:Panel = new Panel(etc);
var Pan2:Panel = new Panel(etc);
var Pan3:Panel = new Panel(etc);
var Pan4:Panel = new Panel(etc);

One of these instances is manipulated at a time. I'd like to refer to this 'active' instance like:

var ActivePanel:Panel = Pan3;

But in such a way, that when I change: ActivePanel.property1, this also automatically changes the original instance (i.e. Pan3.property1).

I've searched Google for an answer, but I guess with the wrong query... Can anyone please point out how to do this?

Thanks a lot!

David

A: 

You will need to extend the panel class to create a new class (called clonedLabel for e.g) and create a clone method...

This is some psuedo code ...

<mx:Panel>

     <mx:Script>
         <![CDATA[

            public function clone():ClonedPanel{

                  var clonedLabel:ClonedPanel= new ClonedPanel();

                  // code here to construct new Panel
                  .
                  .
                  .

                  return clonedLabel;

         ]]>
     </mx:Script>


<mx:Panel>
Rick J