dewey
September 17th, 2007, 07:30 PM
Hey Guys,
I'm new to AS3, actually just learning it and I'm having a problem... I have this as my Document Class...
package
{
import flash.display.MovieClip;
import Tile;
public class Player extends MovieClip
{
public function Player()
{
var tile:Tile = new Tile();
tile.x = 10;
tile.y = 10;
addChild(tile);
}
}
}I have this as my Tile class..
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Tile extends MovieClip
{
public function Tile()
{
addEventListener(MouseEvent.CLICK, clickTile);
trace("draw tile");
}
private function clickTile()
{
trace("click");
}
}
}Now when I run the application I get the "draw tile" trace... but I don't see anything on my stage (the Tile is linked with a library object, currently a black square, 100 x 100 in size...
Can anyone tell me what I am doing wrong here?
Thanks!
--d
EDIT:
I got it, yah!
I'm new to AS3, actually just learning it and I'm having a problem... I have this as my Document Class...
package
{
import flash.display.MovieClip;
import Tile;
public class Player extends MovieClip
{
public function Player()
{
var tile:Tile = new Tile();
tile.x = 10;
tile.y = 10;
addChild(tile);
}
}
}I have this as my Tile class..
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Tile extends MovieClip
{
public function Tile()
{
addEventListener(MouseEvent.CLICK, clickTile);
trace("draw tile");
}
private function clickTile()
{
trace("click");
}
}
}Now when I run the application I get the "draw tile" trace... but I don't see anything on my stage (the Tile is linked with a library object, currently a black square, 100 x 100 in size...
Can anyone tell me what I am doing wrong here?
Thanks!
--d
EDIT:
I got it, yah!