1 Reply Latest reply on Jun 28, 2011 5:30 AM by polatkanfatih

    Object reference between two classes

    polatkanfatih

      hi,

       

      i have 2 classes. GiftMain and GiftItem. i attached GiftItem objects into GiftMain. Actually there are 2 more movieclips between them. i declare a variable in GiftItem as giftMain to reference it to the GiftMain. i have a function in GiftItem which is as below;

       

      function setMain(mc:MovieClip){
      
           giftMain = mc;
           trace(giftMain);
      
      }
      

       

      trace outputs the right object in this function in GiftItem class but at another place in the same class, it outputs undefined when it is traced even though it is global variable. I just want to reach GiftMain from GiftItem without using _parent or _root. How can i do that?

       

      thanks...