Return to Snippet

Revision: 28288
at July 6, 2010 12:54 by goatboy91587


Updated Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
	width="436" height="248" creationComplete="mainFunction()">
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			
			//main function to run at application startup
			/* adds event listener to the 'hello2' button
			 * that listens for a user mouseclick. */
			private function mainFunction(): void
			{
				this.hello2.addEventListener(MouseEvent.CLICK, helloFunction);
			}
			
			//event function that fires an alert window on click
                        private function helloFunction(): void
                        {
                          Alert.show('Hello World!', 'Message 2');
                        }
		]]>
	</mx:Script>
	
	<!-- Hello World Example 1 utilizing in line MXML click events -->
	<mx:Label y="36" text="Hello World Example 1" color="#FFFFFF" 
		fontWeight="bold" horizontalCenter="0"/>
	<mx:Button y="62" label="Hello World 1" 
		click="Alert.show('Hello World!', 'Message')" 
		id="hello1" color="#000000" horizontalCenter="0"/>
	
	<!-- Hello World Example 2 using event handlers in AS3 -->
	<mx:Button y="125" label="Hello World 2" 
		id="hello2" horizontalCenter="0"/>
	<mx:Label y="99" text="Hello World Example 2" color="#FFFFFF" 
		fontWeight="bold" horizontalCenter="0"/>
</mx:Application>

Revision: 28287
at July 6, 2010 12:51 by goatboy91587


Initial Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
	width="436" height="248" creationComplete="mainFunction()">
	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			
			//main function to run at application startup
			/* adds event listener to the 'hello2' button
			 * that listens for a user mouseclick. */
			private function mainFunction(): void
			{
				this.hello2.addEventListener(MouseEvent.CLICK, helloFunction);
			}
			
			//event function that fires an alert window on click
			private function helloFunction(evt:Event): void
			{
				Alert.show('Hello World!', 'Message 2');
			}
		]]>
	</mx:Script>
	
	<!-- Hello World Example 1 utilizing in line MXML click events -->
	<mx:Label y="36" text="Hello World Example 1" color="#FFFFFF" 
		fontWeight="bold" horizontalCenter="0"/>
	<mx:Button y="62" label="Hello World 1" 
		click="Alert.show('Hello World!', 'Message')" 
		id="hello1" color="#000000" horizontalCenter="0"/>
	
	<!-- Hello World Example 2 using event handlers in AS3 -->
	<mx:Button y="125" label="Hello World 2" 
		id="hello2" horizontalCenter="0"/>
	<mx:Label y="99" text="Hello World Example 2" color="#FFFFFF" 
		fontWeight="bold" horizontalCenter="0"/>
</mx:Application>

Initial URL

                                

Initial Description

                                

Initial Title
Hello World Flex 3

Initial Tags
Flex

Initial Language
MXML