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 7849295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:28:12+00:00 2026-06-02T18:28:12+00:00

Is there a way within Flex 4 to design a skin such that it

  • 0

Is there a way within Flex 4 to design a skin such that it can listen for events that are dispatched by my main application, which, in this case, is an instance of the <s:WindowedApplication> class?

I tried adding an event listener to the contentGroup in the skin, just for kicks. Not surprisingly, it didn’t work.

Any ideas?

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-02T18:28:13+00:00Added an answer on June 2, 2026 at 6:28 pm

    You want to design a skin for which component?

    If you are designing a skin for WindowedApplication and want to listen for events fired from your WindowedApplication class; then yes. You can use the hostComponent variable in the skin to listen for said events on the instance of the WindowedApplication.

    I believe the hostComponent property is created automatically based on the skin Metadata; unless you’re creating a Mobile Skin then the docs tell you to create it manually. Conceptually like this:

    public var hostComponent : WindowedApplication;
    

    At some future point in the code:

    hostComponent.addEventListener('myCustomEvent',myEventListener);
    

    I don’t know at what point in the Flex Component Lifecycle the hostComponent property is set. I’m sure you could add event listeners w/o issue during the creationComplete event; but probably much earlier in the lifecycle too.

    If that is not what you’re trying to do you can listen for events on the main application anywhere in your code–including skin classes–by referencing the FlexGlobals.topLevelApplication variable:

    var tla : WindowedApplication = FlexGlobals.topLevelApplication as WindowedApplication;
    tla.addEventListener('myCustomEvent',myEventListener);
    

    This is considered a break in encapsulation and I’m not sure I’d recommend it. Events should be used to communicate up; but executing methods and properties should be used to communicate down. In this case you’re using events to communicate down.

    Having the skin class listen for events on the hostComponent is kind of like working sideways–not up or down. I have mixed feelings about that too.

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

Sidebar

Related Questions

is there any way to catch any error within Flex application and send it
is there an easy way within TextMate that I can select a string, hit
Is there a way to uncheck/check a checkbox within a webpage that is loaded
Is there a way to call functions within a class upon instantiation of that
Is there a way within ActionScript 3.0 to: Get all URLRequests() that are made
Is there a way from within a Java application to list all of the
Is there a way within asp.net MVC 2 whereby I can route a request
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.