display list - how to access?

By droid42 | Jul 4, 2009

actionscript3

I’m trying to build a chess game as a project to start learning as3.

Initally the display list seem to be easy, but now I’m stuck.

How would I access the "BlackTorn1" if I have the following structure:

===================================
[object ChessGame] root1
[object MovieClip] instance1
[object ChessBoardPiece] a8
[object MovieClip] square
[object Shape] instance3
[object TextField] gridNum
[object Torn] BlackTorn1
[object Shape] instance131
===================================

I can access the "a8" by following:
gameBoardContainer.getChildByName("a8").y += 10;

but if I try

gameBoardContainer.getChildByName("a8").getChildBy Name("BlackTorn1").x += 25;

it doesn’t work. Or if I try
gameBoardContainer.a8.getChildByName("BlackTorn1") .x += 25;

I get this error.
TypeError: Error #1010: A term is undefined and has no properties.
at ChessGame/setupPieces()
at ChessGame/addPieces()
at ChessGame()

What am I doing wrong?

Thanks for any enlightening answers.
/Michael

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0