actionscript l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
ActionScript PowerPoint Presentation
Download Presentation
ActionScript

Loading in 2 Seconds...

play fullscreen
1 / 22

ActionScript - PowerPoint PPT Presentation


  • 343 Views
  • Uploaded on

ActionScript A Primer ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects are called Symbols in Flash Movie Clip Graphic Button * anything you can manipulate in some way Object oriented?

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'ActionScript' - JasminFlorian


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
actionscript

ActionScript

A Primer

actionscript is
ActionScript is…
  • Object-oriented programming
  • Everything you do in ActionScript does something to some object*
  • Some objects are called Symbols in Flash
    • Movie Clip
    • Graphic
    • Button

*anything you can manipulate in some way

object oriented
Object oriented?
  • You can decide what happens when a user clicks a button without worrying about how the button (or program) knows that it has been clicked
  • You can decide what changes to make to an object’s properties without knowing the internal mechanics of how those changes were made
  • You can program tasks incrementally without sitting down and writing the whole program from start to finish in one session
actionscript deconstructed
ActionScript Deconstructed
  • Class: a group of items that are similar in some way
    • Items are called objects or instances of the class
      • Objects can be concrete (like a button or graphic) or abstract (like a variable that is invisible, but hold data)
      • Objects have two aspects form (properties) and function (methods)
  • Each property and method is defined by Actions (pieces of code that tell Flash how to manipulate a target object at any point in your movie).
actionscript metaphor
ActionScript Metaphor
  • Ball could be considered a class of items defined as “spherical things”
    • One object in this class is a movie clip called Tennis_ball
      • The properties of Tennis_ball might be the color neon green or a 20-pixel diameter
      • Its methods might be bounce, roll, and/or spin
    • A 2ndobject in the ball class might be Softball
      • Properties white…etc.
actionscript flow
ActionScript Flow
  • Flash executes ActionScript statements starting with the first statement and continuing in order until it reaches the final statement or a statement that instructs ActionScript to go somewhere else.
slide7
One type of action that sends ActionScript somewhere other than the next statement is an if statement
actions
Actions
  • Tell Flash to do something
    • Frame actions
    • Object actions
  • Actions also can have parameters
gotoandplay
gotoAndPlay
  • This frame action sends the playhead to the specified frame in a scene and plays from that frame. If no scene is specified, the playhead goes to the specified frame in the current scene.
functions
Functions
  • Perform a specific task
  • Like in a spreadsheet program (Excel)
getversion
getVersion
  • Returns the Flash Player version number and operating system information.
  • You can use this function to determine whether the Flash Player that is in use can handle your Actionscript.
properties
Properties
  • All available information about an object
  • You can use ActionScript to read and modify object properties
  • All property names begin with an underscore (e.g., _visible)
visible false
_visible = false
  • This property make an object invisible
  • Assign the following action to a button…

On (release) {

_visible = false;

}

  • Button disappears on mouse click
method
Method
  • Similar to actions in that they effect objects
  • Built into objects
  • Invoked (Executed) through dot notation
rocketmc gotoandplay blastoff
RocketMC.gotoAndPlay(“BlastOff”);
  • ActionScript notation must end in ;
  • Movie clip Rocket MC goes to a frame labeled BlastOff and plays
variables
Variables
  • hold data for use in your Flash movies
  • Variables can hold any type of data
  • You could store:
    • User name
    • Result of calculation
    • True or false value
expressions
Expressions
  • An expression is any statement that Flash can evaluate and that returns a value.
  • You can create an expression by combining operators and values or by calling a function.
operators
Operators
  • Expressions use operators to tell Flash how to manipulate the values in the expression.
  • They are the commands that say “add these values” or “multiply these numbers”
some types of operators
Some types of operators
  • Assignment:
      • are used to assign values to variables.
      • The most common is (=). It makes the variable on the left equal to the value of the variable or expression on the right.
  • Comparison and equivalence:
      • (<), (>), (< =)
  • Numeric:
      • perform mathematical operations on values
looping
Looping
  • When you need to repeat certain actions in your movies more than once.
  • Makes coding more efficient, using the same set of commands as many times as necessary to complete a task.
looping examples
Looping examples
  • while
      • Creates a loop that continues to repeat as long as a condition remains true
  • for
      • Creates a loop that executes a specific number of times using a counter
  • for…in
      • Creates a loop that executes once for each member of a group of objects (class)
      • This makes certain that the entire group of objects is processed in the same way
hints
Hints
  • Before you begin writing scripts, formulate your goal and understand what you want to achieve.
  • Planning your scripts is as important as developing storyboards for your work.
  • Start by writing out what you want to happen in the movie, as in this example:
    • I want to create my whole site using Flash.
    • Site visitors will be asked for their name, which will be reused in messages throughout the site.
    • The site will have a draggable navigation bar with buttons that link to each section of the site.
    • When a navigation button is clicked, the new section will fade in at the center of the Stage.
    • One scene will have a contact form with the user's name already filled in.