Skip to main content
Participant
September 3, 2014
Question

error 1120 Acess of undefined property with simple program !

  • September 3, 2014
  • 1 reply
  • 225 views

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();

  }

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
September 3, 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?

zemo20Author
Participant
September 3, 2014

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

Ned Murphy
Legend
September 3, 2014

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.