George
George

Reputation: 15561

ActionScript 3 clock example in flash

I am currently reading the book called "Programming ActionScript 3.0" available from Adobe. After the chapter about "Working with dates and times" the book provides some examples.

http://livedocs.adobe.com/flex/3/html/help.html?content=Part6_ProgAS_1.html

However, their archive contains only the sources for the Flex version. Here is my attempt to make it work in Flash CS4:

http://www.mediafire.com/download.php?j2gkyyntqdo

I have changed the sources files to extend sprite instead of UIComponent, and added a little actionscript to the first frame:

import com.example.programmingas3.clock.*;


var a:SimpleClock = new SimpleClock();
a.initClock(100);

This compiles and I can even see the results of my trace commands in the Output window, but the addChild in the initClock function adds nothing to the display.

How can I fix this?

Upvotes: 1

Views: 2044

Answers (1)

Jeff Winkworth
Jeff Winkworth

Reputation: 4996

try adding to the code below:

addChild(a);

to add it to the stage.

Upvotes: 1

Related Questions