R Bowen
R Bowen

Reputation: 77

addChild() in Actionscript 3

var c = new Cloud();
c.x = Math.random() * 350;
c.y = Math.random() * 700;
clouds.push(c);
stage.addChild(c);

This code is in my document class, I don't get any errors, tracing the x, y, or even c values show correct values. Alas the Cloud objects are not visible.

I have tried parent.addChild(c) and stage.addChild(c); nothing seems to show them.

(note my stage is 350 width and 700 height)

Upvotes: 0

Views: 406

Answers (1)

Emin A. Alekperov
Emin A. Alekperov

Reputation: 1067

Try to add a sprite instance at (100, 100) and draw on it a black rectangle (width = 100, height = 100). If you see it then the problem with the cloud instance (the cloud white on the white background?), and you should check a drawing method of the Cloud class.

Upvotes: 1

Related Questions