Building Flash-based websites using Adobe Flex - Lesson 4/10
Click here to load reader
-
Upload
stefano-virgilli -
Category
Documents
-
view
581 -
download
0
description
Transcript of Building Flash-based websites using Adobe Flex - Lesson 4/10
![Page 2: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/2.jpg)
Agenda
● Overview of Actionscript 3.0
● Variables and data types
● Conditionals
● Loops
● Functions
● Binding to variables
![Page 3: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/3.jpg)
Flash Platform
Actionscript
Flash Flex Framework
.swf .swf
Overview of Actionscript 3.0
![Page 4: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/4.jpg)
● 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)
Overview of Actionscript 3.0
![Page 5: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/5.jpg)
● Syntax:
● e.g.
● Common data types
Variables and Data Types
![Page 6: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/6.jpg)
● 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:
Conditionals – if-else statement
![Page 7: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/7.jpg)
● If more than 2 test cases, include else-if statements.
● Syntax:
Conditionals – if-else statement
![Page 8: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/8.jpg)
● Conditional operators are used to validate the test cases in the if clause.
Conditionals – Conditional Operators
![Page 9: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/9.jpg)
● To include more than one test cases within a if or else-if clause.
Conditionals – Compound conditions
![Page 10: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/10.jpg)
● 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:
Loops
![Page 11: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/11.jpg)
● 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.
Functions
![Page 12: Building Flash-based websites using Adobe Flex - Lesson 4/10](https://reader038.fdocuments.in/reader038/viewer/2022100600/55583890d8b42acb078b49fe/html5/thumbnails/12.jpg)
● Ensure a property or variable always get the latest value of another property or variable
● e.g.
Binding to Variables