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

error 1120 Acess of undefined property with simple program !

New Here ,
Sep 03, 2014 Sep 03, 2014

I am new to flash and this error keeps happening and i don't know what is wrong with code i'd be glad if i got helped here is my code

package code

{

  import flash.display.Sprite;

  import flash.text.TextField;

  import flash.text.TextFormat;

  import flash.display.MovieClip;

  public class Example extends MovieClip

  {

  public var answer:Number = 42;

  public function showGreeting():void

  {

  var message:String = "Hello, world!";

  trace(message);

  }

  var myTest:Example = new Example();

  myTest.showGreeting();

  }

TOPICS
ActionScript
202
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 ,
Sep 03, 2014 Sep 03, 2014

My first guess would be that the two lines you have at the end are meant to be somewhere else other than the class file itself, such as in the main timeline of whatever file you are creating...

  var myTest:Example = new Example();

  myTest.showGreeting();

What is the complete error message?

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
New Here ,
Sep 03, 2014 Sep 03, 2014

Thx a lot for replying the full error says  (Line 23:Acess of undefined property MyTest.)

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 ,
Sep 03, 2014 Sep 03, 2014
LATEST

Since the error shows it capitalized then you should check to make sure how you define it.  And I still believe those last two line do not belong in the class file.

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