The web site for Flash ActionScript 3.0 game developers

 
         
   

exercise about having include clips (from chapter 4 of the book)

hello,

this question is not really concerning the book, it deals with a personal program I created in order to test the mechanism of included clips, as shown in the memory exercice (chapter 4 of the book).

I would like to tell you what I did:

I created in Flash two symbols: symbole_1 and symbole_2.
I selected by double-clicking the symbole_1,clicked on symbole_2, maintained the button down, and go to the scene: then I think symbole_2 is IN symbole_1.
after that, I added some littre pictures in the symbols : a hand-drawn figure in symbole_1.
in symbole_2, I added 2 key-pictures: one with a blue square, and in the other picture, a red square.

what I would like to have is : always the hand-drawn picture, and varying with the code, the blue or the red square.

I modified the property tab (publish/class -> "symbole") after having chosen the clip symbole_1.

and finally I created the actionscript "symbole.as" in which I put:

***************************************************
package{
import flash.display.*;

public class symbole extends Sprite{

public function symbole(){
var this_symbole:symbole_1=new symbole_1();
addChild(this_symbole);
this_symbole.symbole_2.gotoAndStop(2); //line alpha

}

}

}
***************************************************

I added the option "export for actionscript" in the property tab of the "symbole_1" clip.

when I launch the animation without the "line alpha", I have the two colors which repeat in loop :blue and red, blue and red,etc.
what I would like to do is to add what I called "line alpha", in order to set the color of the square.
but I have an error :"TypeError: Error #1010: A term is undefined and has no properties.
at symbole()"

maybe the symbole_2 is not well defined...
can you help me?



Copyright Gary Rosenzweig