Many flash users speak that they "code on AS2", but majority of them do not understand what is OOP. They have some ideas about this, but write programs in the personnel of clips and consider "classes" excess navorotom of large sense in which they see. OOP ideology - key moment, which differs AS1 from AS2.
If write programs in the clips, it means you code on AS1.
If AS1 - your first language of programming. That to pass on Action Script 3 you will be more complexly. SINCE in your brain (as earlier in my) there are harmful bends of the abstract model Movie Clips.
If you worked on Action Script 2 the entire somewhat simpler, because of the principles OOP, by which it is possible to learn in Action Script 2.
All flash AS1 users, will confuse the new model of work with the clips.
Earlier to programming clip from the library was thus:
clip.attachMovie('linkageId', 'clipName', depth)
1. Code the new copy of symbol linkageId
2. they created the new variable clipName in clip clip.
Process is not sufficiently customary for the programmer. By two line literals we create incomprehensible type variable in object clip.
In Actions Script 3 logic more greatly standards.
Which to create some graphic element and to place it on the scene is necessary:
1. To create new symbol in the library and to draw something in this symbol.
2. To associate the created symbol with the class:
Simply click by right button on the symbol in library, select Linkage. In the opened window check Export for ActionScript.
In the text field "Class" introduce the name of class.
3. to create the instance of class and to program where is necessary by the method addChild().
You will allow they created in the library symbol they associated it with class Square.
package
{
import flash.display.Sprite;
public class Board extends Sprite
{
public function Board()
{
var aSquare:Square = new Square()
this.addChild(aSquare);
}
}
}
No comments:
Post a Comment