
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
328
|
Chapter 13: MovieClip Subclasses
Properties and Methods of Nested Assets
Initially Undefined
The Flash Player takes an “outside-in” approach to component and movie clip initial-
ization. When initializing a movie clip hierarchy in a movie, the Flash Player starts with
the outermost clip in the hierarchy, defines its custom properties and methods, then
moves on to its child clips, defines their custom properties and methods, and so on. As
a result, immediately after a clip is constructed, it can see its parent’s custom methods
and properties, but it cannot see its children’s custom methods and properties.
For example, consider a movie clip symbol, ChatRoomSymbol, that represents a chat
room. It contains the following component instances:
outgoing
A TextInput component for outgoing messages
incoming
A TextArea component for incoming messages
userList
A List component for the list of users in the room
Suppose we use a ChatRoomSymbol instance via composition in a class, ChatRoom,
as follows:
class ChatRoom {
private static var chatroomID:Number = 0;
private var chat_mc:MovieClip;
public function ChatRoom (target:MovieClip, depth:Number) {
// Create clip instance.
chat_mc = target.attachMovie("ChatRoomSymbol",
"chatroom" + ChatRoom.chatroomID++,
depth);
chat_mc.userList.dataProvider = [{label:"Colin", ...