1 Reply Latest reply on Jul 12, 2010 7:05 AM by IFZen

    Lost in public method (yes, I do)

    IFZen Level 1

      Hi everybody,

       

      I am loosing my mind on this one since friday, please help me, my brain starts to liquify.

       

      I have a MainClass on a FLA file that defines both public, private, statics or not, properties and methods.

       

      I also have a package named 'components' that stocks Sprite sub-classes for my movie exportable clips. In one of them, I use the "this.root" property to access my main class instance elements at runtime.

       

      When I try to access my main class public properties, this is just sweet like honey.

       

      When I access public method references, same thing, I can trace them and have a true reponse to the question : [myPublicMethod is Function] ?

       

      BUT, when I want to execute the public methods, like MainClass(this.root).myPublicMethod(), the compiler boldly throws this at me :

       

      Error 1195: Attempted access of inaccessible method myPublicMethod through a reference with static type MainClass.

       

      What am I doing wrong here ?

       

      Any help will save neurons, collegues, mouse and screen

       

      François

        • 1. Re: Lost in public method (yes, I do)
          IFZen Level 1

          Well, I made it working by not typing the this.root access, something like that :

           

          var myMainClassInstance:* = this.root;


          myMainClassInstance.myPubluicMethod();

           

          And it works, the compiler is ok and running time is good.

           

          Before that here is what I tried, desperatly : MyMainClass(this.root).myPublicMethod();

           

           

           

          Well, today is another day,

           

          François