Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return.

Similar presentations


Presentation on theme: "Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return."— Presentation transcript:

1

2 Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return value This is stuff you’ll be using forever if you decide to continue programming so make sure you understand it all.

3 Review of Previous Classes Conditional If statements Arrays Loops Event listeners

4 Scenario When you turn on a car with a car key in the ignition, the key itself is an abstraction. The key doesn't actually do anything to turn on the car. The key is just an inert object designed to plug into the ignition. The actual engine turns on the car. But the car manufacturer would never expect you to learn how to open up the hood and tinker with the spark plug in order to turn on the car. That would be inconvenient and unrealistic. As the consumer, you just want a fast, secure and easy way to turn on the car without requiring an engineering degree to do so. So they've conveniently packaged the entire process into the ignition switch which requires a key to activate.

5 API API is a generic term and stands for Application Programming Interface. Practically everything in programming is based on an API of some sort. Think of the car key as an API. It’s designed so you just plug it in and it somehow magically turns on the car. You don’t really care how it works as long as it works.

6 API A programming language like ActionScript is more of an abstract layer of instructions for controlling how the computer behaves. When you say "play a sound file" - ActionScript doesn't actually directly play the sound for you. What it does is it goes to the computer and accesses the sound hardware and then instructs the hardware: "this user has asked me to play this specific sound file" and the hardware will play the sound file as asked. The sound hardware itself might have to do some super complicated procedure in its integrated circuits to physically play the actual sound. ActionScript just makes the request via the API.

7 API Classes We use classes to access these APIs. Think of classes as a control panel that includes an entire set of buttons that make up an interface for you to press when you want something specific to magically happen.

8 API Classes Except they exist in ActionScript code format that you can access. This way, you can integrate an API with Flash to do specific functionality in your program.

9 Classes and Objects Classes are known as Objects after they're instantiated. The term class is an abstraction for a type of object. Think of a class like a brand. An object is a physical version of that brand. While you can’t physically OWN that brand, you can buy an object from that brand name. Instantiating an object is like buying an object of that brand. var myCar:MercedesCar = new MercedesCar(); Sometimes, the two terms Class and Object are used interchangeably.

10 Classes and Objects For example, when the marketers are trying to sell you on buying their car, they're not marketing a specific individual car that physically sits in a dealer lot somewhere, they're marketing an entire line of cars that fall under that brand name. The actual car itself when you buy it is an object.

11 API Package APIs might have several different classes to perform its functionality. We call these a package for “a package of classes”. For example, if we had a car API, it might have a class for the CD player which would include all the functionality to control only the CD player. We might have another API for the transmission which would have all the functionality to control the car's transmission system.

12 Methods/Properties/Events All classes can have three things: properties, methods and events. - A property is a VARIABLE assigned to that class. - A method is a FUNCTION assigned to that class. - An event is an EVENT that you can listen to. Different methods, properties and events can be accessed from different classes. These are only accessible from an instance of that class and no where else.

13

14 Switch to syntax.doc


Download ppt "Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return."

Similar presentations


Ads by Google