1 Reply Latest reply on Feb 7, 2008 6:20 AM by Gregory Lafrance

    Access of undifined Property

    Sunilnairg
      Hi all,
      I am new to Flex. I was trying to create my first application. I copied sample code frm Help But It is giving an error message,
      "1120 :Access of undifined Property Greeter".

      Pls help me to fix the error.
      this is my code
      ------------------------------------------------------------------------------------------ -----------------------------------------------------------------
      mxml file:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*"
      layout="vertical"
      creationComplete = "initApp()" >

      <mx:Script>
      <![CDATA[
      public function initApp():void
      {
      // says hello at the start, and asks for the user's name
      mainTxt.text = Greeter.sayHello(); //Here I m getting the error
      }
      ]]>
      </mx:Script>

      <mx:TextArea id = "mainTxt" width="400" />

      </mx:Application>

      ------------------------------------------------------------------------------------------ ---------------------------------------------------------------------

      .as file:
      package
      {
      public class Greeter
      {
      public function sayHello(name:String):String
      {
      var greeting:String = "Hello " + name + "!";
      return greeting;
      }
      }
      }

      pls help me