Skip to main content
DiegoDiazCuellar
Known Participant
January 11, 2010
Question

Sintaxis definitions

  • January 11, 2010
  • 1 reply
  • 403 views

Hi to everyone.

I'm working in a flash presentation and I'm writting code ... i'll would like ton know what is the definition (or what it means):

1. new Sprite();

2. stage.addChild(cont);

3. cont.addChild(newMedia);

Note: cont. is a variable.

Thanks .....

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
January 11, 2010

1. new Sprite();

// by itself it means little... it would have to be assigned as an object as in: var cont:Sprite = new Sprite();

2. stage.addChild(cont);

// ths line is taking an object instance named "cont" and is adding it to the display list (making it visible)

3. cont.addChild(newMedia);

// this line is doing the same thing as the last line except rather than adding it to the stage, it is adding it to the "cont" object

Also, based on what your code shows, cont is not really a variable as much as it is a reference to an instance of some object.  When you create an object using code you use var to declare it.

DiegoDiazCuellar
Known Participant
January 12, 2010

Thanks .... it's good write code and knowing what you arte writting ...

Ned Murphy
Legend
January 12, 2010

You're welcome