2 Replies Latest reply on Sep 29, 2008 9:42 PM by BudHud

    Return String From Class to Main File

    BudHud Level 1
      This combo of main and class file looks fine. I run it and I click the 'Enter Text' button, and I get no text in the boxes output and output1. There are no errors. I can't understand why I get no text. Any ideas?

      CLASS FILE:

      package Try
      {
      public class Editor
      {
      public function Greeter()
      {
      }
      public function sayManyGreetings(): Array
      {
      return [ "Hello", "Bonjour", "Guten tag", "G'Day" ];
      }
      }
      }

      MAIN FILE:

      <mx:Script>
      <![CDATA[

      import Try.Editor;

      private function initApp():void
      {
      var myEditor:Editor = new Editor;

      output.text = myEditor.sayManyGreetings[ 0 ];
      output1.text = myEditor.sayManyGreetings[ 1 ];
      }
      ]]>
      </mx:Script>

      <mx:Text id="output" width="100%" textAlign="left" x="10" y="20"/>
      <mx:Text id="output1" width="100%" textAlign="left" x="10" y="40"/>
      <mx:Label x="48" y="182" click="initApp()" width="105" text="Enter Text"/>

      Thanks,

      BudHud