HOW TO SEND AN 'OUT' EVENT TO A COMPONENT?

I am writing an AIR application that has many components.  The main application has a "start" button to start a new project, and when you leave a project, the application returns to the start page.  Even if you exit back to the start page, the main MXML components used in the application are not destroyed, because there is no way to destroy them that they just rest here idle in the background and not visible in the State of 'start '.  The problem is that, when a user clicks on the "start" button to start a new project, the MXML components appear in the new project in the former State that they were in because there is no obvious way to reset.  If there was a way to destroy the components, and then when they were recreated in a new project I could initialize with a creationComplete handler.  But since you can't literally destroy a component MXML, I need a way for components to be able to listen to the main program for a click on the button 'Start' event, and then each component to initialize itself when he hears the event.  So I need instead of components passes an event up to the main application, the main application to send an event down to the components.  Is there a way to send an event to the main application on various components?  (or is there a way to destroy a MXML component so that you can recreate later I don't know of?)

Yes, that will do the job, but it is preferable to use a custom event and you need not a property.

I quickly did a small example in Flash using a static variable as a plate rotating Central shipped...

Create a class:

package {}

import flash.events.EventDispatcher;

SerializableAttribute public class EventHub extends EventDispatcher {}

public static var Dispatcher: EventHub = new EventHub();

public void EventHub() {}

the constructor code

}

}

}

in the pane to add this

EventHub.dispatcher.addEventListener ("INIT_COMPONENT", _onInitComponent);

the Manager of the event within your component

private void _onInitComponent(e:Event):void {}

trace ("received INIT_COMPONENT");

}

everywhere where you have trigger init, add this

EventHub.dispatcher.dispatchEvent (new Event ("INIT_COMPONENT"));

Paul

Tags: Flex

Similar Questions

  • How to send fake keyboard event escape?

    Hi guys

    I stuck in a problem. in fact, I want to know if there is no way to send the event false escape in flex.

    I mean sending an event customized after pressing ESC on the keyboard fakely.

    Thanks and greetings

    Mohit

    Hello Mohit,

    Is that worked with the approach of menu.hide ()...? How did you get your mouseout/mouseouthandler() event on the Application... You can share the code of work example... :))

    Can you please give this post answered.

    Thank you

    Jean Claude

  • Sending pictures to option is grayed out. How to send the picture using Windows Photo Gallery?

    Original title: Gallery

    I would like to know how to send an image to a file open. When I choose "" send to "this option is"greyed out"."

    Do you use "Windows Photo Gallery" of Vista, or a third party library?  ' Send to ' is not normally associated with the images of the Windows Photo Gallery in Vista?

    Photos from the photo gallery Windows send to Flash memory
    http://social.answers.Microsoft.com/forums/en-us/vistapictures/thread/60055083-019c-44e0-b5d4-ba0640bd4522

  • How to send IPS events to a Remote Syslog server

    Can someone point me to a doc tech "how to send IPS (v7.x) events to a Remote Syslog server.

    Pls kindly marks the message as answered. Thank you.

  • How do I programmatically send an Itemclick event in Flex 3?

    Hello

    I need assistance with program allocation an itemclick in Flex 3 event.

    For example, I have a popupmenubutton as follows:

    <mx:PopUpMenuButton
        id="myPopUpMenuButton"
        label="Neighborhoods"
        dataProvider="{myNeighborhoodList}" 
        itemClick="myPopUpMenuButtonClickHandler(event)"
    />
    

    Let's say that the myNeighborhoodList contains 3 choices: old Port, Newport, Southport.

    In another piece of code, I want to send the myPopUpMenuButton itemclick event programmatically as if 'Newport' was chosen. How do I do that?

    FYI, I posted this question on stack overflow, but I don't have an answer.

    Thank you!

    -Laxmidi

    OK, here is how to solve the architectural problem.  A class must be responsible for the viewstack index.  This class can respond to events sent anywhere.  So it goes a little something like this.

    The view stack

    ....

    StackPresentation.as

    ...

    public var stackCount:int;

    [Bindable] public var stackIndex:int;

    ...

    public function start (): int

    {

    stackIndex = someRandomNumberGenerator (0, stackCount);

    Return stackIndex;

    }

    public void changeStackHandler (newStackIndex:int): void

    {

    stackIndex = newStackIndex;

    }

    There are a few things I need to explain here.

    1. the stackIndex of the StackPresentation class in 'injected' into the Viewstack class.  This can be accomplished using a number of frames.  Personally I use Mate, but there is a cornucopia of the DI frameset (Prana, RobotLegs, Swiz...).

    2 when you want to change the battery of an index any part of the application, send you an event like the one I posted earlier.  Your frame will be wire this event to the StackPresentation.  The event will be some settings (i.e. var newStackIndex:int) which he uses to go to the index after the battery, it could very well be different from what I posted as it is an example.

    The benefits of this are many.  But they all come from the "separation of concerns".   The view class is responsible for an overview, and the presentation is responsible for coordinating the State of the view class.  The other advantage is that if another part of the application wants to change the index viewstack, it MUST cross the presentation layer, preventing a type "ball of mud" approach.  This reduces the number of bugs and the time it takes to resolve them.  In scenarios where there is a problem, just look at a few things, the logic in the presentation class (which lends itself to unit tests) and cases where the change event is dispatched.  I hope this helps.

    Sincerely,

    Ubu

  • Can someone tell me which makes snmp service send a trap event. I mean, snmp does not monitor anything. To send a trap, a person or an application request SNMP to do. Which?

    I was doing some research on SNMP and MIBs.Hit a roadblock when this question came to my mind. Windows stores all MIBs under

    %SystemRoot%\System32

    I know that these MIBs are used to send traps. I just want to know the throughput, or how it's done. Who reads all this information and provides it to the snmp service to send a trap event? If I need to send traps that are defined in some other MIBs, how can I do it?

    Any help will be appreciated. :)

    Hello

    The question you posted would be better in the Technet forum. Check out the link and ask the question.

    http://social.technet.Microsoft.com/forums/en-us/winserver8gen/threads

  • How to organize the libraries &amp; events

    Hello

    I am very familiar with older versions of FCP, organized in the new clip is so difficult for me to understand.

    Can someone explain to me how to use libraries and events to stay more organized? Or point me in the direction of an article or page that explains it?

    I will give you general information on the way in which I use the program... I'm working on videos on security for a construction company. I'm going to go out and get the interviews used why security is important to them, and we kick off each video with a few of their responses. Then the rest of the video is on a topic of special security rules, then it includes an interview with a security professional, some b-roll of the guys working on our sites and narration.

    I find it frustrating that when I import clips he sorts them by date, and I can't reorganize or rename how they are grouped. For example, I would like to group together all the clips of the employee called 'interviews with employees' and be able to collapse can have a category called "field shots" or "b-roll"; and another group for professional discussions of security. My biggest beast is the date... because I could film interview employee today and then again the next week and they are away from each other when I look at my clips & I can't move them so that they are all side by side for when I want to add to my project.

    Any help would be appreciated... or if you think it's better explained in person, let me know and I'll put in place an individual session.

    Thank you!

    Encrassante out dates in the popup of action in the toolbar. Change of content created on None.

    Use collections of keywords to interviews of employees in the group, shots on the ground, b-roll.

  • HP Laser Jet MFP M127fn Pro: How to send a fax using speed dial?

    I have a new HP Laser Jet MFP M127fn Pro: how to send a fax using speed dial, I entered already numbers in the address book.

    I'm embarrassed to say that I spent several hours trying to get the speed dial to work on a M127fn.  It turns out that there really no speed dial.  That's the conclusion of at least a HP tech that actually used the machine.  Another tech was able to describe a way to fax a phonebook entry, but it is quite too complicated to be called a speed dial.

    [1] press the button settings (key).

    [2] press the right arrow to access the phone book.

    [3] press OK button.

    [4] use the right or left buttons to reach the desired phone book entry.

    [5] press the OK button to reveal the label for the entry, or "empty" if it is not set.

    [6] press the OK button if the element is set to display the fax or dialing options.

    [7] press FAX to initiate a fax to this phone book entry.

    My users find it much easier to have their phone numbers pasted on the machine where they can connect looking them to instead scroll through menus, for the right option.

    It seems that there is some sort of disconnect between hardware, firmware, and technical writers on this machine, because this ancient feature has been neglected, and the user guide is left to sputter on the issue.

  • I have CC line but no line JIU in my Windows Mail and cannot find information on how to send BCC emails.

    I have CC line but no line JIU in my Windows Mail and cannot find information on how to send BCC emails.

    original title: the line JIU in Windows Mail in Vista

    Open a new message window and: reviews | All the headers. Check it out.

  • How to send a mail in oracle 10g

    I am new to oracle developer... we use oracle 10g developer... How to send messages via oracle 10 g on a click.pease button help me.

    Thanks in advance

    This question was asked several times on this forum, see if you get the help of the following:

    https://forums.Oracle.com/message/5395438#5395438

    Search results: https://forums.oracle.com/thread/search.jspa?peopleEnabled=true&userID=&containerType=&container=&q=form+email

    Check this out as well:

    http://nzchaudhry.WordPress.com/2013/05/31/send-report-via-email-attachment-in-Oracle-Forms-10G/

    You can find the init.ora or initSID.ora file under $ORACLE_HOME/dbs on linux and Windows under $ORACLE_HOME/database. Otherwise, you can create using the command "create pfile from spfile.

    Aneel

  • Send the keyboard event of the clip loaded by the parent mouse click

    Hello. I'm building a swf wrapper that loads the third-party swf games. The customer wants a button in the package, that will send a keyboard event in the loaded swf file.

    Can someone give me hand on how to build an event to send in the wrapper which penetrates into the loaded swf file?

    Thank you very much!

    After that is finished loading:

    MovieClip (yourloader.content) .dispatchEvent (new KeyboardEvent (somekeyboardevent));   If the loaded swf file is a movieclip

  • How to send an audio message, but not with imessage?

    How to send an audio message, but not with imessage?

    Find another app/service that will allow you to do. Or record a voice memo using the voice recorder application and attach to an SMS.

  • How can I find out what version of firefox I use

    How can I find out what version of firefox I use

    https://support.Mozilla.org/en-us/KB/find-what-version-Firefox-you-are-using

    Left thread Firefox Android for Firefox section.

  • I can't find how to 'send' my email, please help?

    I use Firefox and my Yahoo email account. I have composed an email and I'm ready to send it out, but I can't find the button 'send '?

    In the current design on Yahoo mail, the Send button appears at the bottom of the message editor on the left end of a row of icons. I have attached a screenshot for reference to screen.

    If you access your mail using an old address, either a bookmark or the old homepage, there could be a problem Firefox redirection to the currently preferred mail server. Try to access e-mail using this generic link and leaving Yahoo redirect you there:

    https://mail.Yahoo.com/

    If it is an AT & T Yahoo account, try to get your mail through the AT & T Yahoo home page.

  • How to send to apple iphone for repair of the screen

    Hi, I bought an iphone over 6s (64 GB) two weeks ago, the screen has been hacked by accident.

    I looked up on the apple site the cost of repair in the citation is $ 249

    However, when will organize a repair via the apple website he's trying to make me pay more than $500 Ouch!

    I think it's because they want to send me authorized service center apple not themselves, someone has a solution to this question and a suggestion how I can get this repaired for $249.  IE, how to send to apple authorized reseller.

    I'm in Darwin in Australia

    With our thanks

    Suresh

    Hello

    Contact Apple support (mail service may be available) or make a Genius Bar reservation to repair screen.

Maybe you are looking for