Building Flash-based websites using Adobe Flex - Lesson 4/10

702 views

Published on

Building Flash-based websites using Flex
Lesson 4 – Actionscript Essentials

by Alex goh, associate trainer @ LAB School ( http://lab.edu.sg/ ), Adobe Authorized Training Centre, Singapore

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
702
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building Flash-based websites using Adobe Flex - Lesson 4/10

  1. 1. Building Flash-based websites using Flex Lesson 4 – Actionscript Essentials Alex Goh info@alekkus.com
  2. 2. Agenda ● Overview of Actionscript 3.0 ● Variables and data types ● Conditionals ● Loops ● Functions ● Binding to variables
  3. 3. Overview of Actionscript 3.0 Flash Flex Framework Actionscript .swf .swf Flash Platform
  4. 4. Overview of Actionscript 3.0 ● While MXML is sufficient for drawing the user interface on screen, embedding user interactions and changing application behaviour requires executing scripts (similar to the role Javascript plays in HTML documents). ● Why Actionscript 3.0 (AS3) was introduced? ● Needed a Object-oriented Programming Language to support large-scaled application development ●An attempt to bring developers on board onto the Flash platform, which was traditionally regarded as a playground for designers ● AS3 is based on ECMAScript, the same scripting engine of Java, hence, Java developers will find it easier to learn AS3. P.S. Many products from Adobe are Java-based. (e.g. Coldfusion, BlazeDS, LiveCycle ES)
  5. 5. Variables and Data Types ● Syntax: ● e.g. ● Common data types
  6. 6. Conditionals – if-else statement ● In many cases, the program needs to behave differently or execute different codes based on certain scenarios. ● The most common conditional statement is the if-else statement. ● Syntax:
  7. 7. Conditionals – if-else statement ● If more than 2 test cases, include else-if statements. ● Syntax:
  8. 8. Conditionals – Conditional Operators ● Conditional operators are used to validate the test cases in the if clause.
  9. 9. Conditionals – Compound conditions ● To include more than one test cases within a if or else-if clause.
  10. 10. Loops ● Loops cause a block of codes to execute repeatedly, for as long as its test case holds true. ● All common looping methods are available in AS3: ● while loop ● do-while loop ● for loop ● for loop:
  11. 11. Functions ● A function is a grouping of a block of codes that can be executed when called. ● Reasons for using function: ● Reusability ● Event handling ● e.g.
  12. 12. Binding to Variables ● Ensure a property or variable always get the latest value of another property or variable ● e.g.

×