Actionscript 3 - Session 2 Getting Started Flash IDE - Presentation Transcript
Computer Animation with Flash CS3 & ActionScript 3.0 National Polytechnic Institute of Cambodia Bachelor of IT, Year III, Semester 1 2007-2008 by Oum Saokosal, Head of IT Department
ActionScript and the Flash Authoring Tool p.821 Computer Animation with Flash CS3 & ActionScript 3.0
ActionScript and the Flash Authoring Tool
Write ActionScript in Flash
Timeline Script
Accessing Created Symbol Instances
New Event Handling in AS3
Write ActionScript in Flash (1)
Tools for Writing Code
Flash authoring tool: Adobe Flash CS3
Adobe Flex Builder 2 (an IDE)
Notepad + Flex 2 SDK
Write ActionScript in Flash (2)
To write AS on Timeline:
Click on a key frame and then press F9.
Timeline Script (for AS3.0)
Methods:
play();
stop();
gotoAndPlay();
gotoAndStop();
nextFrame();
prevFrame();
Properties
currentFrame
currentLabel
currentLabels
totalFrames
Accessing Created Symbol Instances (1)
Create a symbol: MovieClip or SimpleButton.
Create an instance by dragging it from the library to the stage.
Input a name to every instance, say, movie1 and button1 . After that, you can call these names in the AS.
Click on a keyframe and write code:
Accessing Created Symbol Instances (2)
Properties:
movie1.x = 20; //set x location
movie1.y = 40; // set y location
movie1.width = 100; // set new width
movie1.height = 200; // set new height
Accessing Created Symbol Instances (3)
Where these properties came from?
In AS3, all display objects are inherited from DisplayObject class.
movie1 is also DisplayObject so it can use every properties and methods of DisplayObject class.
For more details, click Help menu ->
-> ActionScript 3.0 Language and Component Reference
-> All Classes
-> DisplayObject
New Event Handling in AS3 (1)
AS3 changes the event handling, eg. Click on buttons, to a new machanism.
on ()
onClipEvent()
.onload
addListener()
UIEventDispatcher()
.addEventListener()
New Event Handling in AS3 (2)
How to make a button clickable?
Create a symbol: Movie Clip or Button.
Create an instance by dragging it from the library to the stage.
Input a name to every instance, say, movie1 and button1 .
Click on a keyframe and write code:
(Note in AS3, we can never write codes on buttons anymore. We MUST write these on the keyframe.)
Actionscript 3 - Session 2 Getting Started Flash ID more
Actionscript 3 - Session 2 Getting Started Flash IDE Taught by Oum Saokosal, Head of Information Technology, National Polytechnic Institute of Cambodia less
0 comments
Post a comment