HOW DO YOU SEND AN EVENT "OUT" TO A COMPONENT?

I am writing an AIR app that has many components.  The main application has a "start" button to begin a new project, and when you exit a project, the application returns to the start page.  Even though you exit back to the start page, the major MXML components used in the application do not get destroyed because there is no way to destroy them so they just sit there idle in the background and not visible in the "start" state.  The problem is that when a user clicks the "start" button again to start a new project, the MXML components appear in the new project in the old state that they were in because there is no obvious way to reinitialize them.  If there was a way to destroy the components, then when they were recreated in a new project I could initialize them with a creationComplete handler.  But since you can't literally destroy an MXML component, I need a way for the components to be able to listen to the main program for a click event on the "start" button, and then each component initializes itself when it hears the event.  So instead of components passing an event up to the main application, I need the main application to send an event down to the components.  Is there a way to send an event from the main application out to the various components?  (or is there a way to destroy an MXML component so that you can recreate it later that I am unaware of?)

Yes, that will do the job, though it's better to use a custom event and you don't need a property.
I quickly made a tiny example in Flash using a static variable as a central dispatch hub..
Create a class:
package  {
    import flash.events.EventDispatcher;
    public class EventHub extends EventDispatcher {
        public static var dispatcher:EventHub = new EventHub();
        public function EventHub() {
            // constructor code
// in the component add this
EventHub.dispatcher.addEventListener("INIT_COMPONENT", _onInitComponent);
// the handler for the event inside your component
private function _onInitComponent(e:Event):void{
    trace("INIT_COMPONENT received");
// wherever you need to trigger init, add this
EventHub.dispatcher.dispatchEvent(new Event("INIT_COMPONENT"));
Paul

Similar Messages

  • How can you send an email out to more than 65 persons at a time?

    I have an email notification list of 175 persons who regularly get communications from me. I have recently discovered that only 65 of them are getting these emails. How can I send to my entire list?
    Thanks!

    Is the list stored on a server or in Thunderbird?
    I'm not aware of a limit to the number of recipients of a message in Thunderbird when you use a list. A limit may be imposed by your service provider as an anti-spam measure. You may want to search around to learn more about any limits there.

  • How do I send an Event created in Calendar on my iPad2 via e-mail?

    How do I send an Event created in Calendar on my iPad2 via e-mail?

    Hello, light diva. 
    Thank you for visiting Apple Support Communities. 
    Here is an article that walks you through the process of sending calendar invites. 
    Invite others to an event
    http://support.apple.com/kb/PH4706
    Cheers,
    Jason H. 

  • How do you send iMessage TO an iPad?

    How do you send iMessage TO an iPad? Everyone tells me to send message to the Apple ID email. The problem is that I can only type numbers in the send to box. Even selecting contact from addressbook I can only choose a phone number, not the email. So for the iPad I can send iMessages to an iPhone but not to iPod or iPad becasue these devices dun hv a number.

    When I tap on the compose button it automattically brings up the keyboard.  Yours doesn't do that?  Also, when I begin typing the name of a contact, it defaults to their phone number.  If I scroll down, then I can see emails for contacts with that name.  Hope you get it figured out!
    Another tip is to make sure that your ipad is set up to receive messages using a different email than your iphone.  You can change that in your settings.

  • How do you send text message to a number that is less than ten didgits?

    How do you send text messages on the iPhone, to a number that is less than 10 digits? And example of this might be a number from the radio station.

    i got the same....the ones tht charge u 9.99 a month. i didnt even open it nd it still charged me. i already had them blocked on all my phones through verizon sumhow it went through. so i jus called up verizon again explained wut happened nd they took it off, all the charges. so mayb jus go down to ur local verizon store and tell them u want them blocked from coming to ur phone. hope i helped u out!! good luck

  • Can you send an event created on your iphone to a contact from your iphone?

    Can you send an event created on your iphone to a contact from your iphone? If so I can't figure it out. I have asked this question before and somebody told me you could if you were a mobileme or exchange user. Well I am a mobileme user and if it can be done, I can't figure it out.
    Any help appreciated.

    From the calendar app on my iphone? I know I can do it from iCal and from mobileme. When I look at the event on my iphone I can look at the invitees, but I do not see where I can add or delete an invitee. Maybe I am just missing it.

  • How would you have an event recur weekly? monthly? Yearly?

    How would you have an event recur weekly? monthly? Yearly? I want to be able to insert an event for a weekly occurring meeting, however.... I don't want to have to insert it for every occurrence myself.

    Hi,
    If you are using 10g, this is trivial using dbms_scheduler
    e.g.
    grant create job to user_that_runs_insert ;
    Then as the user do
    BEGIN
    dbms_scheduler.create_job(
    job_name => 'weekly_meeting',
    job_type => 'STORED_PROCEDURE',
    job_action => 'weekly_proc'
    repeat_interval => 'FREQ=WEEKLY;BYDAY=SUNDAY;BYHOUR=20;BYMINUTE=0;BYSECOND=0',
    comments => 'job runs every Sunday at 8pm',
    enabled=>true);
    END;
    Instead of weekly, you can just as easily to monthly or yearly.
    If you don't want anything to run but you just want a list of dates that is on a weekly schedule you can use dbms_scheduler.evaluate_calendar_string in a loop to figure out which dates fall on a certain pattern. Docs and an example is here
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm#i1009923
    Hope this helps,
    Ravi.

  • Hi, We are a physiotherapy practice trying to use i-cal as a clinic diary systaem for 15 therapists. We need to block out availability of therapists but cant do this? How can you block someones diary out for specific times on i-cal? Any help please..

    Hi, We are a physiotherapy practice trying to use i-cal as a clinic diary system for 15 therapists. We need to block out availability of therapists but cant do this? How can you block someones diary out for specific times on i-cal? Any help please..

    iCal is designed for personal use, and isn't really meant to handle this sort of situation.
    The best suggestion I can offer, though it's a trifle untidy, is: create a calendar for each therapist, giving each a different colour. Enter the availability for each therapist - if it's on a weekly basis you can make them repeating events. Then add the individual appointments, which will show alongside in the daily view. In this example, the 'purple' therapist is available from 1030 to 1700 and has appointments at 1200 and 1500.
    If you have more than a few therapists available at any one time it's liable to look a bit messy, but it's the best I can think of at the moment.

  • How do you send a web page in safari

    How do you send a web page in safari

    File > Mail Contents of This Page
    File > Mail Link to This Page

  • How do you send an email to a specific person based on if a particular check box is checked?

    How do you send an email to a specific person based on if a particular check box is checked?

    Try the LiveCycle Designer forum.

  • How do you get your iphone out of the connect to itunes screen?

    How do you get your iphone out of the connect to itunes screen?

    What error message is it displaying? Check this Apple support document for information on specific error messages when restoring the iPhone. http://support.apple.com/kb/ts1275

  • How will you send SMS by using any  java technology

    how will you send SMS by using any java technology

    Wikipedia has an entry on that protocol...
    http://en.wikipedia.org/wiki/SMPP
    Written by a 12 year old and edited by a H.S. student with a C+ average (or vice versa), so you know it's accuracy has been verified and you can trust your career on it!
    OK, I don't know that is true and you probably guessed it, but I'm not a big fan of the Wikipedia concept, but that doesn't matter as long as you understand that the information contained within Wikipedia is not vetted in any traditional way. And yes, I do use Wikipedia occasionally as a resource but I do it knowing that accuracy of the information is always in question.
    Probably doesn't need discussing in this forum, but if you are curious, there was on interesting discussion about Wikipedia here:
    http://online.wsj.com/public/article/SB115756239753455284-zM_NmQpDWtRRSoHcPYcbQ6iq4H4_20061011.html?mod=tff_main_tff_top

  • How do you change password with out using cd on imac?

    How do you change password with out cd on imac?

    Please read:
    http://osxdaily.com/2011/08/24/reset-mac-os-x-10-7-lion-password/

  • How do you send movies back to iCloud

    How do you send movies back to iCloud after watching them

    Movies are not stored in your personal iCloud account.
    Delete the file from the device (it will still be available for download again).

  • How can you view an event's time in the month mode of the calendar without clicking on it?

    How can you view an event's time in the month mode of the calendar without clicking on it?

    bbmca,
    Have you tried enlarging the month view window?

Maybe you are looking for

  • Cyrillic fonts in Story?

    Dear Adobe, could you please install Cyrillic fonts? I can not neither name project in Russian, nor write a line in script.

  • Exception in thread "main" java.lang.NoClassDefFoundError: Emp/class

    Dear all, It occur 'Exception in thread "main" java.lang.NoClassDefFoundError: Emp/class' error when I test a oracle java sample.I've already SET CLASSPATH=C:\ORACLE\JDBC\LIB\CLASSE~1.ZIP. following is the source code: import java.sql.*; class Emp pu

  • One or more post-processing actions failed. Consult the OPP service log

    When i run the report i got WARNING in the status...But my XML file was generated correctly. when i saw the OOP Log file, i got this message, [5/2/13 9:56:45 AM] [OPPServiceThread0] Post-processing request 5875515. [5/2/13 9:56:45 AM] [2063716:RT5875

  • Respository setup in OWB 9 vs OWB 10.2

    Hi , I have been working with oracle warehouse builder 10.2 and owb 11 release R1 , I was wondering how the repository was setup in owb ver9.Any help would be greatly appericiated. Regards, MALAM

  • Macbook Pro temperature after installing Mountain Lion

    Hi guys, I wonder if any of you could give me a little help. I installed ML about one week ago and i've been noticing that my macbook pro (from mid 2009, 13inch) has been increasing. With itunes, chrome a minor download program called igetter CPU tem