• About Us
  • Classroom Training
  • Online Training
    • Self Paced Courses
      • HTML and CSS For Beginners (with HTML5)!
      • Javascript for Beginners
      • C Programming: iOS Development Starts Here!
      • Objective C For Beginners
      • PHP MySQL For Beginners
      • Web Development Code Camp
    • Live Instructor Courses
      • HTML and CSS with HTML 5 (Live)
      • Javascript for Beginners (Live)
      • C Programming for Beginners (Live)
      • Objective C for Beginners(Live)
      • Android Development Code Camp (Live)
      • iOS Development Code Camp (Live)
      • HTML5 & Advanced Client Side Development (Live)
      • Actionscript for Beginners (Live)
  • Forum
  • Testimonials
  • Contact Us
    • Actionscript
    • Android
    • C/C++/Objective C
    • HTML/CSS
    • iOS
    • Java
    • Javascript
    • PHP
Home > Actionscript > How To Actionscript: Events

How To Actionscript: Events

Posted by Mark Lassoff on November 18th, 2011 Actionscript, events, Flash Builder, Flash Professional, Flex, MXML, tutorial, Video
| No Comments

Events are serious business in Actionscript– When the user clicks, double clicks, focuses on an object, right clicks, etc., an event is generated. Dealing with those events is a large part of successful Actionscript programming. In this video, Mark will teach you the basics of events and also take a look at the event object and how you can use it to write more efficient code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?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" minWidth="500" minHeight="400"
			   creationComplete="init()">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
			private function init()
			{
				btnOne.addEventListener(MouseEvent.CLICK, clickOne);
				btnTwo.addEventListener(MouseEvent.CLICK, clickOne);
			}
 
			private function clickOne(event:MouseEvent)
			{
				//txtResult.text = "Button One has been clicked";
				var id = event.target.id;
				if(id == "btnOne")
				{
					txtResult.text = "Button One has been clicked";
				} else
				{
					txtResult.text = "Button Two has been clicked";
				}
			}
			/*
			private function clickTwo(event:MouseEvent)
			{
				txtResult.text = "Button Two has been clicked";	
			}
			*/
		]]>
	</fx:Script>
	<s:Button x="9" y="10" label="One" id="btnOne"/>
	<s:Button x="10" y="39" label="Two" id="btnTwo"/>
	<s:TextArea x="156" y="10" height="50" id="txtResult"/>
</s:Application>

Tags: Actionscript, events, Flash Builder, Flash Professional, Flex, MXML, tutorial, Video

Leave a Reply

Click here to cancel reply.

Join our mailing list

Free video tutorials, course information and more!

* required

Email Address *

First Name

Last Name:

Email Marketing Software by VerticalResponse
Apple Store Facebook Google+ LinkedIn RSS Feed Twitter YouTube
Provided by The Social Links

Like Us!

Live Online Course

Online event registration powered by Eventbrite

Self Paced Course

What is ?

We train software, web and mobile developers. Our classes geared to the way adults learn are available online, or in-person at your office or training center.

New Android Book

Android Programming Code Camp by Mark Lassoff. Coming in 2012. Finally, a true beginners book on Android programming and development. No Experience required.

Email me when the book is available

On Learning

  • Top Languages Used in Web Development
  • How To Learn a Programming Language: 5 Tips
©LearnToProgram.tv 2012 .All rights reserved.