introducing actionscript 3.0 object-oriented programming language used to power flash player similar...
Post on 19-Dec-2015
219 views
TRANSCRIPT
Introducing ActionScript 3.0Object-oriented programming languageUsed to power Flash PlayerSimilar to JavaScriptCan be embedded in a Flash project (.fla) fileWritten as a stand-alone ActionScript (.as)
file, or created in Flex Builder (new tool built on Adobe’s Flex framework – creating RIAs (Rich Internet Applications)
ActionScript help a Flash designer to leap the hurdle and create fully interactive applications, dynamic Web applications and interactive video games
History of ActionScript ActionScript 1.0ActionScript 2.0ActionScript 3.0
ActionScript 1.0/2.0 vs 3.0
myMovieClip.createTextField(“thickness_text”, 10, 0, 0, Stage .width, 22);
var myText:TextField = new TextField();
Class Method Instance Name Properties
Class MethodInstance Name
ActionScript 1.0/2.0
ActionScript 3.0
ActionScript 3.0 New Features
Feature Description
Package AS 3.0 classes are organized into packages, folders that hold similar AS class files.
Document class
Introduced by Flash CS3. Allowed to create own custom class for the main Timeline
AS tools Help to learn how to write and organize code more effective
Scripting improvements
Provide new AS debugger that offers improved flexibility and feedback and is consistent with Flex 2 debugger.Can convert animations directly to AS Copy and paste AS animation propertise from one object to another
Language consistency
More consistent in syntax
Benefits of ActionScript 3.0fast downloading speedprecise visual controladvanced interactivitycapable to combine bitmap and vector
gaphicsinclude video and animationscalable and streaming content
SMM3111 - Multimedia Programming
ActionScript 3.0 elements, including the following:VariablesInstancesPropertiesFunctions and methodsEvent, event handlers, and event listenersClassesConditional statements
SMM3111 - Multimedia Programming
Communicating to Movie ClipsFirstly, transform the object into a movie clip symbol
(a type of predefined class).Give an instance name which ActionScript can
interact with it.A guidelines when naming symbols, instance and
document files in Flash:Use lowercase letters (a-z) for the first characterUse descriptive names to make it easy to rememberDo not use special character (!, @, #, $, % and many
others)Never use spacesNever put periods (.)Never put slashes (/)Example:
mcRectangle; rectangle_mc; etcSMM3111 - Multimedia Programming
Modifying movie clip propertiesGiving a script to movie clips:
i. select a particular frame on a particular layerii. choose Window > Actions or press F9 to
open the Actions panel
SMM3111 - Multimedia Programming
Actions panel has three basic areas Script pane – where you
type the ActionScript Actions toolbox –
contains a listing of all the classes, methods, events and parameters
Script navigator – use to navigate to the different frames containing ActionScript
Example:rectangle1_mc.alpha = .5;
Meaning:telling Flash that the object’s (instance name =
rectangle1_mc) is given alpha property or transparency that equal to .5 or 50 percent.
semicolon shows the end of statement
SMM3111 - Multimedia Programming
Understanding variables and setting variable data typeVariable – a container that holds information
or different data syntax in ActionScript: var <variable_name>
eg.: var userName
Giving a value to the variable. The value or data type will be string and numbers.
eg.: var userName:String = “Todd”;
SMM3111 - Multimedia Programming
Trace StatementsTo make sure the code is syntaxed and
running properlySyntax in ActionScript:
trace <variable_name>/<(string)>
SMM3111 - Multimedia Programming
A trace statement pops up in the Output panel when we test or publish the movie.
Output panel has no information or a coded error message.
It helps you check the code and isolate any problems when you start to work with complicated files.
CommentsComments are notes – usually to yourself or
to other coders looking at the file.Used to explain coding decisions, such as
the file organization, orannotate the code, orsometimes, temporarily turn off a block of code
Two type of comments:// - line comments/* - block comments
SMM3111 - Multimedia Programming