Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6916163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:34:00+00:00 2026-05-27T09:34:00+00:00

In my AIR application, I try to dispatch a custom event from a class

  • 0

In my AIR application, I try to dispatch a custom event from a class to main window.
This class is use to call httpservice. My goal is to send a custom window when the httpservice result is send.

package fr.inter.DataProvider
{
    import flash.events.Event;
    import flash.events.EventDispatcher;

    import fr.inter.config.urlManager;
    import fr.kapit.introspection.components.DisplayListComponent;

    import mx.collections.XMLListCollection;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.http.HTTPService;

    [Event(name="evtPatSelect", type="flash.events.Event")]

    public class sPatient
    {

        private var _phppaIndex:String;
        private var _phppaNomU:String;
        private var _phppaPrenom:String;
        private var phpSearchPatNom:HTTPService;


        public function sPatient()
        {

        }


        public function sPhpSearchPat(p:Object):void
        {

            phpSearchPatNom = new HTTPService();
            phpSearchPatNom.method="POST";
            phpSearchPatNom.resultFormat = "e4x";
            phpSearchPatNom.addEventListener(ResultEvent.RESULT,resultListePatient);
            phpSearchPatNom.addEventListener(FaultEvent.FAULT,serviceFault);
            var urlPhp:urlManager=new urlManager();
            phpSearchPatNom.url = urlPhp.urlService() + "20SearchNom.php";
            phpSearchPatNom.send(p);
        }


        private function resultListePatient( event:ResultEvent ):void
        {

            var xmlList:XMLList = XML(event.result).patientPHP;
            var xmlListColl = new XMLListCollection(xmlList);


            if(xmlListColl.length==1)
            {

                _phppaIndex = xmlListColl.getItemAt(0).paIndex;
                _phppaNomU = xmlListColl.getItemAt(0).paNomU;
                _phppaPrenom = xmlListColl.getItemAt(0).paPrenom;

                var evtPat:Event = new Event("evtPatSelect");

                var evdips:EventDispatcher = new EventDispatcher();
                evdips.dispatchEvent(evtPat);

            }
        }



        private function serviceFault( event:FaultEvent )
        {
            trace( event.fault.message );
        }

        public function get phppaIndex():String
        {
            return _phppaIndex;
        }

        public function set phppaIndex(value:String):void
        {
            _phppaIndex = value;
        }

        public function get phppaNomU():String
        {
            return _phppaNomU;
        }

        public function set phppaNomU(value:String):void
        {
            _phppaNomU = value;
        }

        public function get phppaPrenom():String
        {
            return _phppaPrenom;
        }

        public function set phppaPrenom(value:String):void
        {
            _phppaPrenom = value;
        }


    }
}

In main window I’ve added a eventlistener but this seems not works.
Can you help me to solve that?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:34:01+00:00Added an answer on May 27, 2026 at 9:34 am

    First, extend the sPatient class as an EventDispatcher

    public class sPatient extends EventDispatcher {
    

    Then, create a class for your custom Event

    public class MyCustomEvent extends Event {
            public static const CUSTOM_TITLE:String = "custom_title";
            public var eventData:Object;
    
            public function CustomEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, data:Object = null) {
                super(type, bubbles, cancelable);
                if(data != null) eventData = data;
            }
    
            public override function clone():Event {
                return new CustomEvent(type, bubbles, cancelable);
            }
    
            public override function toString():String {
                return formatToString("CustomEvent", "type", "bubbles", "cancelable", "eventPhase");
            }
        }
    

    Then in your sPatient class, go:

    this.dispatchEvent(new MyCustomEvent(MyCustomEvent.CUSTOM_TITLE));
    

    And listen for it like so

    sPatientInstance.addEventListener(MyCustomEvent.CUSTOM_TITLE,functionHandler);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Air application with a main window. I would like to have
I have written an AIR Application that downloads videos and documents from a server.
I would like to be able to operate a scanner from my AIR application.
I have an Adobe AIR application for Android. Using for this AIR 3.0 and
I have an AIR application that is downloaded from a webpage. In order to
I'm trying to access a webservice with an SSL connection from an AIR application,
I'm trying to build an application using AIR 2's new NativeProcess API's going from
We have an Adobe AIR application which could be possibly downloaded from multiple domains.
In my Adobe Air application I have a change event handler attached to a
We have developed Air application and next step it is porting this application to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.