Posted By

goatboy91587 on 07/06/10


Tagged

Flex


Versions (?)

Hello World Flex 3


 / Published in: MXML
 

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
  3. width="436" height="248" creationComplete="mainFunction()">
  4. <mx:Script>
  5. <![CDATA[
  6. import mx.controls.Alert;
  7.  
  8. //main function to run at application startup
  9. /* adds event listener to the 'hello2' button
  10. * that listens for a user mouseclick. */
  11. private function mainFunction(): void
  12. {
  13. this.hello2.addEventListener(MouseEvent.CLICK, helloFunction);
  14. }
  15.  
  16. //event function that fires an alert window on click
  17. private function helloFunction(): void
  18. {
  19. Alert.show('Hello World!', 'Message 2');
  20. }
  21. ]]>
  22. </mx:Script>
  23.  
  24. <!-- Hello World Example 1 utilizing in line MXML click events -->
  25. <mx:Label y="36" text="Hello World Example 1" color="#FFFFFF"
  26. fontWeight="bold" horizontalCenter="0"/>
  27. <mx:Button y="62" label="Hello World 1"
  28. click="Alert.show('Hello World!', 'Message')"
  29. id="hello1" color="#000000" horizontalCenter="0"/>
  30.  
  31. <!-- Hello World Example 2 using event handlers in AS3 -->
  32. <mx:Button y="125" label="Hello World 2"
  33. id="hello2" horizontalCenter="0"/>
  34. <mx:Label y="99" text="Hello World Example 2" color="#FFFFFF"
  35. fontWeight="bold" horizontalCenter="0"/>
  36. </mx:Application>

Report this snippet  

You need to login to post a comment.