Monday, 31 March 2008

Action Script 2: Vector Illustration Example

Interesting article on vector illustration in FLASH.
http://www.kirupa.com/developer/flashcs3/flash_vector_illustration.htm

Drawing LINES in AS2

this.createEmptyMovieClip("line_mc", 1);

with(line_mc){
lineStyle(5, 0x000000, 50, true, "normal", "square", "miter", 1);
moveTo(0, 0);
lineTo(150, 0);
_x=100;
_y=150;
}

Drawing CURVES in AS2

this.createEmptyMovieClip("circle_mc", 1);
with (circle_mc) {
beginFill(0xFF0000);
moveTo(100, 100);
curveTo(200,0,300,100);
curveTo(400,200,300,300);
curveTo(200,400,100,300);
curveTo(0,200,100,100);
endFill();
}

Drawing SHAPES in AS2

this.createEmptyMovieClip("square_mc", this.getNextHighestDepth());
square_mc.lineStyle(5, 0xff00ff, 100, true, "none", "round", "miter", 1);
square_mc.beginFill(0xFF0000);
square_mc.moveTo(10, 10);
square_mc.lineTo(100, 10);
square_mc.lineTo(100, 100);
square_mc.lineTo(10, 100);
square_mc.lineTo(10, 10);
square_mc.endFill();

Saturday, 29 March 2008

Action Script 2: Hello World

Actionscript tutorial sites:
http://www.actionscript.org/resources/categories/Tutorials/
http://www.kirupa.com/developer/flash/index.htm

//Hello World in Actionscript (Flash MX onwards)
_root.createTextField("mytext",1,100,100,300,100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = false;
myformat = new TextFormat();
myformat.color = 0xff0000;
myformat.bullet = false;
myformat.underline = true;
mytext.text = "Hello World!";
mytext.setTextFormat(myformat);

Interestingly, here is a link to a page for helloworld code in a billion different languages!

http://www.roesler-ac.de/wolfram/hello.htm#Actionscript-FlashMX

Tuesday, 11 March 2008

JQUERY: Lightweight Javascript framework to handle super smooth GUI designs

Found and interesting javascript framework that will improve UI design. Framework is called JQUERY, framework allows alot of mundane UI codes to be written quickly with CCS3 compliance and good cross browser compatibility.

http://jquery.com/

Monday, 10 March 2008

Action Script: History

Extract from wikipedia:

Timeline by player


Flash Lite 1.0: Flash Lite is the Flash technology specifically developed for mobile phones and consumer electronics devices. Supports Flash 4 ActionScript.

Flash Lite 1.1: Added support for some Flash 5 ActionScript.

Flash Lite 2.0 and 2.1: Added support for Flash 7 ActionScript 2.0.

Flash Lite 3: Added FLV video playback.

Flash Player 2: The first version with scripting support. Actions included gotoAndPlay, gotoAndStop, nextFrame and nextScene for timeline control.

Flash Player 3: Expanded basic scripting support with the ability to load external SWFs (loadMovie).

Flash Player 4: First player with a full scripting implementation (called Actions). The scripting was a slash based syntax and contained support for loops, conditionals, variables and other basic language constructs.

Flash Player 5: Included the first version of true ActionScript. Used Prototype-based programming based on ECMAScript, and allowed full Procedural programming and Object-Oriented programming.

Flash Player 6: Added an event handling model, accessibility controls and support for switch. The first version with support for the AMF and RTMP protocols which allowed for ondemand audio/video streaming.

Flash Player 7: Additions include CSS styling for text and support for ActionScript 2.0, a Class programming language based on the ECMAScript 4 Netscape Proposal. However, ActionScript 2.0 can cross compile to ActionScript 1.0 byte-code, so that it can run in Flash Player 6.

Flash Player 8: Further extended ActionScript 1/ActionScript 2 by adding new class libraries with APIs for controlling bitmap data at run-time, file uploads and live filters for blur and dropshadow.

Flash Player 9 (initially called 8.5): Added ActionScript 3.0 with the advent of a new virtual machine, called AVM2 (ActionScript Virtual Machine 2), which coexists with the previous AVM1 needed to support legacy content. Performance increases were a major objective for this release of the player including a new JIT compilation. Support for binary sockets, E4X XML parsing, full-screen mode and Regular Expressions were added. This is the first release of the player to be titled Adobe Flash Player.

Timeline by ActionScript version

2000–2003: ActionScript "1.0" With the release of Flash 5 in September 2000, the "actions" from Flash 4 were enhanced once more and named "ActionScript" for the first time.[2] This was the first version of ActionScript with influences from JavaScript and the ECMA-262 (Third Edition) standard, supporting the said standard's object model and many of its core data types. Local variables may be declared with the var statement, and user-defined functions with parameter passing and return values can also be created. Notably, ActionScript could now also be typed with a text editor rather than being assembled by choosing actions from drop-down lists and dialog box controls. With the next release of its authoring tool, Flash MX, and its corresponding player, Flash Player 6, the language remained essentially unchanged; there were only minor changes, such as the addition of the switch statement and the "strict equality" (===) operator, which brought it closer to being ECMA-262-compliant. Two important features of ActionScript that distinguish it from later versions are its loose type system and its reliance on prototype-based inheritance. Loose typing refers to the ability of a variable to hold any type of data. This allows for rapid script development and is particularly well-suited for small-scale scripting projects. Prototype-based inheritance is the ActionScript 1.0 mechanism for code reuse and object-oriented programming. Instead of a class keyword that defines common characteristics of a class, ActionScript 1.0 uses a special object that serves as a "prototype" for a class of objects. All common characteristics of a class are defined in the class's prototype object and every instance of that class contains a link to that prototype object.

2003–2006: ActionScript 2.0 The next major revision of the language, ActionScript 2.0, was introduced in September 2003 with the release of Flash MX 2004 and its corresponding player, Flash Player 7. In response to user demand for a language better equipped for larger and more complex applications, ActionScript 2.0 featured compile-time type checking and class-based syntax, such as the keywords class and extends. (While this allowed for a more flexible object-oriented programming approach, the code would still be compiled to ActionScript 1.0 bytecode, allowing it to be used on the preceding Flash Player 6 as well. In other words, the class-based inheritance syntax was a layer on top of the existing prototype-based system.) With ActionScript 2.0, developers could constrain variables to a specific type by adding a type annotation so that type mismatch errors could be found at compile-time. ActionScript 2.0 also introduced class-based inheritance syntax so that developers could create classes and interfaces, much as they would in class-based languages such as Java and C++. This version conformed partially to the ECMAScript Fourth Edition draft specification.

2006–today: ActionScript 3.0 In June 2006, ActionScript 3.0 debuted with Adobe Flex 2.0 and its corresponding player, Flash Player 9. ActionScript 3.0 was a fundamental restructuring of the language, so much so that it uses an entirely different virtual machine. Flash Player 9 contains two virtual machines, AVM1 for code written in ActionScript 1.0 and 2.0, and AVM2 for content written in ActionScript 3.0. ActionScript 3.0 provides not only a significant enhancement in performance, but also a more robust programming model that lends itself to complex Rich Internet Application development.

The update to the language introduced several new features:
  • Compile-time and runtime type checking—type information exists at both compile-time and runtime.
  • Improved performance from a class-based inheritance system separate from the prototype-based inheritance system.
  • Support for packages, namespaces, and regular expressions.
  • Compiles to an entirely new type of bytecode, incompatible with ActionScript 1.0 and 2.0 bytecode.
  • Revised Flash Player API, organized into packages.
  • Unified event handling system based on the DOM event handling standard.
  • Integration of ECMAScript for XML (E4X) for purposes of XML processing.
  • Direct access to the Flash runtime display list for complete control of what gets displayed at runtime.
  • Completely conforming implementation of the ECMAScript Fourth Edition Draft specification.

Monday, 3 March 2008

Action Script: About

Actionscript is based on ECMAScript (European Computer Manufacturers Association) specifically the ECMA-262 specification. ECMA-262 is more commonly known as JavaScript (Netscape) or JScript (Microsoft).