Posted By


goatboy91587 on 07/06/10

Tagged


Statistics


Viewed 984 times
Favorited by 0 user(s)

Hello World Flash Builder


/ Published in: MXML
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. xmlns:mx="library://ns.adobe.com/flex/mx"
  5. width="436" height="248" creationComplete="mainFunction()">
  6. <fx:Script>
  7. <![CDATA[
  8. import mx.controls.Alert;
  9.  
  10. // main function that fires when creation is complete
  11. /* adds event listener to the button with the id "hello2"
  12. * that listens for a mouseclick event and designates
  13. * a function to be called when the mouse is clicked. */
  14. private function mainFunction():void
  15. {
  16. this.hello2.addEventListener(MouseEvent.CLICK, helloFunction);
  17. }
  18.  
  19. //function that is fired on click
  20. private function helloFunction():void
  21. {
  22. Alert.show('Hello World!', 'Message 2');
  23. }
  24. ]]>
  25. </fx:Script>
  26.  
  27. <!--Hello World Example 1 using inline MXML click events -->
  28. <s:Label y="30" text="Hello World Example 1" color="#000000"
  29. fontWeight="bold" horizontalCenter="2"/>
  30. <s:Button y="50" label="Hello World 1"
  31. click="Alert.show('Hello World!', 'Message')"
  32. id="hello1" color="#000000" horizontalCenter="1"/>
  33.  
  34. <!-- Hello World Example 2 using event handlers in AS3 -->
  35. <s:Label y="96" text="Hello World Example 2" color="#000000"
  36. fontWeight="bold" horizontalCenter="2"/>
  37. <s:Button y="125" label="Hello World 2"
  38. id="hello2" color="#000000" horizontalCenter="1"/>
  39. </s:Application>

URL: http://www.brettwidmann.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.