Return to Snippet

Revision: 28286
at July 6, 2010 12:21 by goatboy91587


Initial Code
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" 
			   width="436" height="248" creationComplete="mainFunction()">
	<fx:Script>
		<![CDATA[
			import mx.controls.Alert;
			
			// main function that fires when creation is complete
			/* adds event listener to the button with the id "hello2"
			 * that listens for a mouseclick event and designates
			 * a function to be called when the mouse is clicked. */
			private function mainFunction():void
			{
				this.hello2.addEventListener(MouseEvent.CLICK, helloFunction);
			}
			
			//function that is fired on click
			private function helloFunction():void
			{
				Alert.show('Hello World!', 'Message 2');
			}
		]]>
	</fx:Script>

	<!--Hello World Example 1 using inline MXML click events -->
	<s:Label y="30" text="Hello World Example 1" color="#000000"
			 fontWeight="bold" horizontalCenter="2"/>
	<s:Button y="50" label="Hello World 1"
			  click="Alert.show('Hello World!', 'Message')"
			  id="hello1" color="#000000" horizontalCenter="1"/>
	
	<!-- Hello World Example 2 using event handlers in AS3 -->
	<s:Label y="96" text="Hello World Example 2" color="#000000"
			 fontWeight="bold" horizontalCenter="2"/>
	<s:Button y="125" label="Hello World 2"
			  id="hello2" color="#000000" horizontalCenter="1"/>
</s:Application>

Initial URL
http://www.brettwidmann.com

Initial Description

                                

Initial Title
Hello World Flash Builder

Initial Tags
flash, Flex

Initial Language
MXML