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

The Archive Base Latest Questions

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

protected function init(event:FlexEvent):void { btnBack.addEventListener(MouseEvent.CLICK, viewOverview); } protected function viewOverview(event:MouseEvent):void { dispatchEvent( new ChangeSelectedIndex(1,ChangeSelectedIndex.index_passed));

  • 0
protected function init(event:FlexEvent):void
{
    btnBack.addEventListener(MouseEvent.CLICK, viewOverview);
}

protected function viewOverview(event:MouseEvent):void
{
    dispatchEvent( new ChangeSelectedIndex(1,ChangeSelectedIndex.index_passed));
}

I try to add the eventlistener like this, but nothing happens. I’ve checked, and the init function is being called from the creationcomplete statement. Below you can see the button in the containing HGroup.

<s:HGroup x="116" y="0" width="200" height="25">
    <s:Label id="lblOverviewTitle" fontFamily="Verdana" fontSize="24" fontWeight="bold"
             text="Artist Details"/>
    <s:Button id="btnBack" label="Back" />
</s:HGroup>
  • 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:41:21+00:00Added an answer on May 27, 2026 at 9:41 am

    Why do you need to add the event listneer in ActionScript? You can do it in MXML like this:

    <s:HGroup x="116" y="0" width="200" height="25">
        <s:Label id="lblOverviewTitle" fontFamily="Verdana" fontSize="24" fontWeight="bold"
                 text="Artist Details"/>
        <s:Button id="btnBack" label="Back" click="viewOverview(event)"/>
    </s:HGroup>
    

    As stated in the comments to the main question, it seems like you are trying to add the event listener to btnBack before the component is created. You should add the event listener in a initialize event, because initialize fires right after createChildren() is fired.

    If you’re building a Spark Component, and btnBack is a skin part, you should add the event listener in partAdded() method.

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

Sidebar

Related Questions

I have the following bit of code: protected function onEnterFrame(e:Event):void { var diff:Number; //
typedef void (FunctionSet::* Function)(); class MyFunctionSet : public FunctionSet { protected: void addFunctions() {
I cant call protected function in my base class. Why? It looks something like
I have the following code: protected function safePath($path) { $path = (string) $path; $path
Ive got a url: http://dev.local/foodies/view?id=bluedaniel and ive got in my bootstrap: protected function _initRoute()
Login Form: $authAdapter = Zend_Registry::get('authAdapter'); $authAdapter ->setIdentity($formData['email']) ->setCredential($password) ->setCredential(1); Bootstrap: protected function _initAuth(){ $this->bootstrap('db');
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
class ConfigReader { private static $instance = NULL; protected $configData = array(); public function
Why can't I use persistNavigatorState=true and stage.setAspectRatio(StageAspectRatio.PORTRAIT) together in initializing program. <s:View ...creationComplete=init()> protected
In the following example class Employee { var $name; var $city; protected $wage; function

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.