Welcome, Guest
  • Author Topic: using parentApplication.function to access main application  (Read 6869 times)

    kofi addaquay

    • Global Moderator
    • Senior Programmer
    • *****
    • Posts: 450
      • View Profile
      • Scripton Interactive
      • Email
    Hi everyone...just wondering if anyone has used the parentApplication.functionname to access a function on the main application.?
    i have a component in my components folder... with a click button. this is how i am calling the click event

    <mx:Button id="searchButton" label="Search" click="parentApplication.searchClickHandler(event)" />

    simply saying call the searchClickHandler function in the parent application. the function IS define in the main mxml file plus i have added the necessary namespaces. but i get an error saying searchClickHandler not found!


    in the past i would have added a metadata tag in the component and dispatached the event..which has always worked for me. but i am trying to use the parentApplication to access the function this time from the component. any ideas?? its weird. :-\

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Use mx.core.Application.application to access the main application, be sure that the method is public

    Jorge

    kofi addaquay

    • Global Moderator
    • Senior Programmer
    • *****
    • Posts: 450
      • View Profile
      • Scripton Interactive
      • Email
    Yep, it worked :)

    didnt have to import mx.core.Application.application though. just changed the scope of the function to public.

     ;D