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

  • SEARCH
  • Home
  • 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 7971161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:34:23+00:00 2026-06-04T07:34:23+00:00

Is there a way within a Flex Mobile application to listen for events with

  • 0

Is there a way within a Flex Mobile application to listen for events with a <s:View> which is within a <s:ViewNavigator>? Let’s say I have the following application structure:


Main application:

<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  creationComplete="databaseConnection(event)">

  <s:ViewNavigator id="tasks" width="100%" height="100%"
                       label="Tasks" firstView="views.TasksView"
                       title="Tasks" icon="@Embed('assets/icons/tasks.png')">
  </s:ViewNavigator>
</s:TabbedViewNavigatorApplication>

view.TasksView:

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark">

  <s:Button label="New View" click="{navigator.pushView(views.AddTask)}"/>
</s:View>

view.AddTask:

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark"
                creationComplete="{dispatchEvent(new Event("happened"))}">

  <fx:Metadata>
    [Event(name="happened", type="flash.events.Event")]
  </fx:Metadata>
</s:View>

Say I wanted to listen for the happened event way back in my main application. How can I listen for such an event?

Thank you for your time.

  • 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-06-04T07:34:24+00:00Added an answer on June 4, 2026 at 7:34 am

    Yes you can, it can be done something like this:

    First in your application add this property to your root tag:

    initialize="attachNavigationListeners(event)"
    

    The next method will add a complete event to the navigator which needs the custom events:

    private function attachNavigationListeners(event : FlexEvent) : void {
        navigator.addEventListener(Event.COMPLETE,attachViewListeners);
    }
    

    Then we need the view listeners adding when navigator is complete, i have this separate so you can have as many views here as you need, could use a switch statement:

    private function attachViewListeners(event : Event) : void {
        if(navigator.activeView is FirstView) {
              addListenersToFirstView();
        }
    }
    

    Add listener to the view in question:

    private function addListenersToFirstView() : void{
        if(navigator.activeView is Firstview) {
              var view: Firstview = navigator.activeView);
              view.addEventListener("happened", handleHappened);
         }
    }
    

    Finally handle the event:

    private function handleHappened(event:Event) : void{
        // I hope something really did happen :)
    }
    

    NOTE

    Obviously I have just outlined all the steps needed here, I have not provided a full working example to copy and paste, but as you will know what you’re doing to ask this question I hope this can help you, also you have already shown how to dispatch the event from your view.

    I have also used string “happened”, but you would have a const like CustomEvent.HAPPENED or something that suits you to avoid use of strings in this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way within Flex Mobile 4.6 to access the main application from
is there any way to catch any error within Flex application and send it
I have a plugin which is applied on few element. Is there any way
Is there any way within an RSpec tests, by convention or code, to have
Is there a way to apply, say, a DropShadowFilter to the text within a
Is there a way from within a Java application to list all of the
Is there a way within Flex 4 to design a skin such that it
Is there any way within the iOS SDK for an app to delete itself?
I am curious if there is a way from within a WebView when a
Is there a way to password protect SAS CODE within SAS? Or, if not,

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.