ActionScript Basics: Syntax, OOP, and Built-in Types
This guide introduces the foundational concepts of ActionScript, including syntax, object-oriented programming (OOP), and built-in types. It covers essential elements such as package creation and usage, variable declarations, and importing classes. Learn how to declare variables with different types, such as integers, strings, and objects. It also provides examples of defining public classes and functions, as well as initializing arrays. Perfect for beginners looking to grasp the basics of ActionScript programming!
ActionScript Basics: Syntax, OOP, and Built-in Types
E N D
Presentation Transcript
ACtionscript Syntax, OOP, built-in types
packages • package samples • { • publicclassSampleCode • { • publicvarsampleGreeting:String; • publicfunctionSampleCode() • { • //do nothing • } • } • } • //import all classes in package • import samples.*; • //import one class only • importsamples.SampleCode;
Variables var i: int; var s: String = "string"; var i: int = 0, s: String = "s"; var u: uint = 0xffffff; //type Object varsomeObject: Object; varsomeObject: Object = {label: 'label'}; //untyped variable varsomeObject: *; vararray: Array; vararray: Array = new Array(); vararray: Array = [1, 2, 3];