Skip to main content
June 16, 2011
Question

Attempted access of inaccessible method

  • June 16, 2011
  • 2 replies
  • 2191 views

Attempted access of inaccessible method

I cant see the problem as I pass a class with a mesh property .
I am using AS3 and away3D. Everything loads fine .


Description      Resource      Path      Location      Type
1195: Attempted access of inaccessible method enemyMesh through a reference with static type ClassEnemyCube.     

     
      public function moveForward(amt:int,models:Array):void
            {
                   var enemyMesh2:Mesh;
                                   
                  for each (var el:ClassEnemyCube in models) 
                  {
                  enemyMesh2=el.enemyMesh(); //error
-------------------
calls this property

      public function get enemyMesh():Mesh
            {
                  return model5;
            }

This topic has been closed for replies.

2 replies

Inspiring
June 17, 2011

Syntax for accessors (getters and setters) is the same as for properties. So, you loop must be:

for each (var el:ClassEnemyCube in models)
{
     enemyMesh2 = el.enemyMesh;
}

Not - there are no parenthesis attached to enemyMesh.

kglad
Community Expert
Community Expert
June 16, 2011

you shouldn't be using a getter like a method.  use something like:

var m:Mesh=enemycubeinstance.enemyMesh;

June 16, 2011

in the loop or outside the loop?

i cant keep decalring  a var inside the loop

kglad
Community Expert
Community Expert
June 16, 2011

i don't see a loop and your error message isn't related to a loop.