2 Replies Latest reply on May 22, 2010 1:56 AM by nikos101

    Call to a possibly undefined method, why?

    nikos101 Level 2

      For some weird reason I'm getting an error for this code


          import customevents.MysteryAdded;
                  protected function addMysteryShopperResultResult_resultHandler(event:ResultEvent):void
                      dispatchEvent(new MysteryAdded());

      1180: Call to a possibly undefined method MysteryAdded.


      Anything I'm missing?

        • 1. Re: Call to a possibly undefined method, why?
          David_F57 Level 5



          How are you declaring the event , for instance below is  simple event created specifically used to broadcast a login event. The event is dispatched by declaring it new at the moment of dispatch. In the provided code I see you pointing to a class I don't know what is in that class so is MysteryAdded()  a function creating a new event ?




          <?xml version="1.0" encoding="utf-8"?>
          <s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
              [("LoginOk", type="flash.events.Event")]
                      protected function Login_clickHandler(event:MouseEvent):void
                          dispatchEvent(new Event("LoginOk"));
                  <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:Button id="Login" x="301" y="236" label="login in" click="Login_clickHandler(event)"/>

          1 person found this helpful
          • 2. Re: Call to a possibly undefined method, why?
            nikos101 Level 2

            sorry, I got my package name  mixed up and the compiler didn't show me the error.