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

          hi,

           

          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 ?

           

          maybe

           

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

          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.