5 Replies Latest reply on Jun 1, 2009 1:53 PM by injpix

    Calling function in mxml mod

    rckehoe Level 1

      I have my main mxml file and then I have a module that I have developed... I want to be able to call a function in that module from my main application... This is what I have done, and it keeps giving an error saying this:


      TypeError: Error #1009: Cannot access a property or method of a null object reference.


      Here is my code in a nutshell:



      <mx:WindowedApplication xmlns:mods="mods.*">

           <mx:Script src="general.as" />

           <mods:MyObject id="MyObj" />

           <mx:Button click="LoadObjData();" />





      import mods.*;


      private function LoadObjData():void {

           MyObj.CustomFunction("Test Data");




                  public function CustomFunction(CustData:String):void {
                      MyLabel.text = CustData;


      <mx:Label id="MyLabel" />




      //// Can anyone explain to me what I am doing wrong?