Who has started to develop code with scripting languages such as JavaScript or ActionScript the same, may not know all the concept of data type. With some high-level languages, in fact, it used to - at best - to declare variables without giving a specific data type, not counting those languages that do not require any statement (such as PHP - not in the strict version 5 ).
Articles Tagged 'Course'
Actionscript 3.0 for beginners: lesson # 5
Actionscript 3.0 for beginners: lesson # 4
Recall the example of our code of TicTacToe (found in full on Google Code ) and begin to analyze it in detail.
Import definitions
With Actionscript 3.0 has done a great job of cleaning and accommodation nell'alberatura classes (contained in the packages, package ) used during development. In other programming languages, like C for example, when you want to use a feature must explicitly "import" in the code. This operation of "import" is necessary to allow the compiler to have all the codes and definitions related to the features we want to use. ; Actionscript 3.0 mette a disposizione l'istruzione include che è identica all' #include del C/C++. In ActionScript 3.0, however, education import should not be confused with the equivalent C / C + + #include , Actionscript 3.0 provides education include that is identical to ' #include in C / C + +. The latter, in fact, "include" the actual code that, if used or not, the final executable is compiled. The statement import is the highest level and is more "intelligent" at compile time. It is used primarily for access classes without specifying their full name. In alre words instead of using forms such as:
1 |
Actionscript 3.0 for beginners: lesson # 3
We continue the analysis of the example of the game Tic Tac Toe, presented in Actionscript 3.0 for beginners: lesson # 2 . We arrived at the function that creates the game grid:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | / ** * Graphic design grid (3x3) on screen * * @ Param void * @ Return void * @ Private * / createGrid ( ) : void { private function createGrid (): void { / / Temporary pointer to a MovieClip / / Note: here you could also use a Sprite / / But in this case I need to extend the object / / Adding some personal proproetà. The Sprite / / Is a closed class and therefore not extensible runtime, while / / The MovieClip class is a dynamic class and then makes / / Possible to add run-time properties MovieClip , i : uint = 0 ; var tm: MovieClip , i: uint = 0; / / Add the MovieClip in a 3x3 pattern ; i < 9 ; i ++ ) { for (; i <9; i + +) { ( ) ; tm = new MovieClip (); tm ) ; addChild (tm); = OFFSETX + ( ( i % 3 ) * ( PLAYER_WIDTH + PLAYER_OFFSET ) ) tm. offsetX = x + ((i% 3) * (PLAYER_WIDTH PLAYER_OFFSET +)) = OFFSETY + Math . floor ( i / 3 ) * ( PLAYER_HEIGHT + PLAYER_OFFSET ) tm. OFFSETY + y = Math . floor (i / 3) * (+ PLAYER_HEIGHT PLAYER_OFFSET) tm. _index = i; 0 ) ; drawPlayer (tm, 0); } / / Draw the 2 lines and 2 horizontal ranges addressable this . graphics ) { with (this. graphics) { 6 , 0x666666 ) ; lineStyle (6, 0x666666); OFFSETX , OFFSETY + ( PLAYER_HEIGHT + 15 ) ) ; moveTo (offsetX, OFFSETY + (PLAYER_HEIGHT + 15)); OFFSETX + ( ( PLAYER_WIDTH + 20 ) * 3 ) , OFFSETY + ( PLAYER_HEIGHT + 15 ) ) ; lineTo (offsetX + ((PLAYER_WIDTH + 20) * 3), OFFSETY + (PLAYER_HEIGHT + 15)); OFFSETX , OFFSETY + ( PLAYER_HEIGHT + 20 ) * 2 ) ; moveTo (offsetX, OFFSETY + (PLAYER_HEIGHT + 20) * 2); OFFSETX + ( ( PLAYER_WIDTH + 20 ) * 3 ) , OFFSETY + ( PLAYER_HEIGHT + 20 ) * 2 ) ; lineTo (offsetX + ((PLAYER_WIDTH + 20) * 3), OFFSETY + (PLAYER_HEIGHT + 20) * 2); OFFSETX + ( PLAYER_WIDTH + 15 ) , OFFSETY ) ; moveTo (offsetX + (PLAYER_WIDTH + 15), OFFSETY); OFFSETX + ( PLAYER_WIDTH + 15 ) , OFFSETY + ( ( PLAYER_HEIGHT + 20 ) * 3 ) ) ; lineTo (offsetX + (PLAYER_WIDTH + 15), OFFSETY + ((PLAYER_HEIGHT + 20) * 3)); OFFSETX + ( PLAYER_WIDTH + 20 ) * 2 , OFFSETY ) ; moveTo (offsetX + (PLAYER_WIDTH + 20) * 2 OFFSETY); OFFSETX + ( PLAYER_WIDTH + 20 ) * 2 , OFFSETY + ( ( PLAYER_HEIGHT + 20 ) * 3 ) ) ; lineTo (offsetX + (PLAYER_WIDTH + 20) * 2 OFFSETY + ((PLAYER_HEIGHT + 20) * 3)); } } |
Actionscript 3.0 for beginners: lesson # 2
As promised here is the second lesson in ActionScript 3.0! Today we start the analysis of a simple project that reproduces the play or the Tic Tac Toe Tic Tac Toe. I tried to include some special features in this example, ActionScript 3.0, trying to give space to the understanding and not on style. It follows that if I had to write the "game" really, I probably would have structured very differently, but in this case I tried to mediate between a classical program with a compact, hermetic more understandable for newbies.
Actionscript 3.0 for beginners: lesson # 1
Premise
Actionscript 3.0 can be a good starting point to become familiar, those unfamiliar with C programming and / or C + +, orioentata programming (OOP). In addition, this series of lessons will be useful to those coming from other rooms or from earlier versions of Flash.
Set a project
In this first lesson we will see how to set up a project Flash CS3 generic. It is good to use when the projects are expected to have to deal with at least more than one file. The use of the project was introduced - by Macromedia - already in versions prior to CS3, so it should be a subject known to developers Actionscript 2.0.
However with Actionscript 3.0 - as we shall see - it is possible to create a Actionscript (. Pbuh) to the document-root movie ours. Fla so to speak. This feature is very useful and also makes a project minimum of at least two files: the. Fla. As associated. For this reason, you will "always" from a project, so right now organizing the various files (. Fla,. As, ...) that will be part of our "package" of development.
Also, once you learn the dimesticazza with the philosophy to objects, instrinseca in this type of language, end up with many files will be normal, even for simple projects substantially.






Latest Comments
datrix : Thank you very much!
Robert : I rispsoto your questions with pleasure. The idea is really great. I am looking for a solution ...
Sting : @ Darius - you can see an example here: http://www.fight4fun.it/ clicking on: MAPS I hope ...
vik : Giustappunto I'm working on a project and the client asked me to show all the news (which are CPT) in ...
Giovambattista Fazioli : @ paso: absolutely. Simply identifying the field [cci] input [/ cci] you want to ...