Posted By

luismessias on 09/28/10


Tagged

focus


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

bobbym245
alptugan
dubogii


How To Set Focus on UIComponent


 / Published in: ActionScript 3
 

How To Set Focus on UIComponent

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3. layout="absolute" width="246" height="76">
  4. <mx:Script>
  5. <![CDATA[
  6. import mx.core.UIComponent;
  7. public function setFocusTo(object:UIComponent):void
  8. {
  9. object.setFocus();
  10. }
  11. public function drawFocusTo(object:UIComponent):void
  12. {
  13. object.setFocus();
  14. object.drawFocus(true);
  15. }
  16. ]]>
  17. </mx:Script>
  18. <mx:Button x="10" y="10" width="226"
  19. label="my button" id="myButton" />
  20. <mx:Button x="10" y="42"
  21. label="set focus" click="setFocusTo(myButton)"/>
  22. <mx:Button x="103" y="42"
  23. label="set and draw focus" click="drawFocusTo(myButton)"/>
  24. </mx:Application>

Report this snippet  

You need to login to post a comment.