Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts

    enabled/disabled event

    Is there any event that occurs when a component is enabled or disabled? I've got to integrate with a custom component whose source I don't control and would like to determine when the user has done something that causes a subcomponent to be enabled or disabled. I can find the subcomponent by searching through the container hierarchy and add a listener to it, but I can't seem to be able to determine an event for enable/disable
    Wayne Christian

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    There is no event that I know of that will fire when the enabled attribute is changed. Your best course of action would likely be to override the setter function for the component that updates the enabled property, and fire off a custom event. Or, if you control the part of the component that is taking action(a button for instance) you can use a wrapper function to do your event functionality, and then update the component. For example:
    Code:
    <mx:Script>
    	<![CDATA[
    	private function setEnabled(enabled:Boolean):void
    	{
    		// your logic
    		customComponentName.enabled = enabled;
    	}
    	]]>
    </mx:Script>
    <mx:Button label="Disable" click="setEnabled(false)" />
    <mx:Button label="Enable" click="setEnabled(true)" />
    That is not tested -- it's just for example purposes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •