Hi all,
I have a red box called mc1_mc and every time when you drag on it you get a new little blue box added to the stage. Yhe idea is that you can drag those blue boxes too. however I dont know how to detect them.
this is the code:
var newBlok:Boolean;
var blokIndex:int = 0;
var blokje:blok;
var huidigBlok:DisplayObject;
var prullenBak:DisplayObject = getChildByName("groen_mc");
stage.addEventListener(MouseEvent.MOUSE_DOWN,pickUp);
stage.addEventListener(MouseEvent.MOUSE_UP,dropIt);
function pickUp(event:MouseEvent):void
{
trace(event.currentTarget);
trace(event.target);
trace(event.target.name);
if (event.target.name == "mc1_mc")
{
trace("hoi");
blokje = new blok;
blokje.name = "blokje" + blokIndex;
blokIndex++;
addChild(blokje);
blokje.startDrag(true);
}
if (event.target.type == blok)
{
trace("blok");
}
//blokjeVast = blokje;
}
function dropIt(event:MouseEvent):void
{
event.target.stopDrag();
}
he wont ever come to the line: trace("blok"); even when the object i clicked on gives:
[object Stage]
[object blok]
blokje0
for the lines.
trace(event.currentTarget);
trace(event.target);
trace(event.target.name);
does anyone know how to do check if its a object of type "blok"?