Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Attempted access of inaccessible method

Guest
Jun 16, 2011 Jun 16, 2011

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;
            }

TOPICS
ActionScript
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2011 Jun 16, 2011

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

var m:Mesh=enemycubeinstance.enemyMesh;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 16, 2011 Jun 16, 2011

in the loop or outside the loop?

i cant keep decalring  a var inside the loop

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2011 Jun 16, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 16, 2011 Jun 16, 2011
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines