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

Attempted access of inaccessible method

Guest
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

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

Views

2.1K

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

var m:Mesh=enemycubeinstance.enemyMesh;

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

in the loop or outside the loop?

i cant keep decalring  a var inside the loop

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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