I have a map consisting of MovieClip cities inside it and I have a click function in top layer of map MovieClip. I try to do that if I click a city, a rectangle will be drawn. Here is code:
function rpress(a)
{
trace( "trying" );
var b:MovieClip = new MovieClip();
b.graphics.beginFill(0xFF0000);
b.graphics.drawRect(0,0,100,80);
b.graphics.endFill();
b.x = 150;
b.y = 150;
addChild( b );
trace("done")
}
Trace commands are executed but no rectangle is drawn. I tried MovieClip( root ).addChild..., stage.addChild..., MovieClip( parent ).addChild...
and others...
Do you have any idea? Thank you!
FULL CODE:
Double Click map MovieClip->84 layers welcome us->Chose the layer named "Action Layer" ACTIONS-FRAME:
function rbtxt(a)
{
var _loc2 = a;
var _loc3 = this;
balon._visible = true;
arbtxt = ilad.split(",");
balon.txt.text = arbtxt[_loc2];
_loc3["x" + _loc2].play();
balon._x = _loc3["x" + _loc2]._x;
balon._y = _loc3["x" + _loc2]._y - _loc3["x" + _loc2]._height / 2 + 5;
}
//End of the function
function rbalon(a)
{
balon._visible = false;
this["x" + a].gotoAndStop(1);
}
//End of the function
function rpress(a)
{
trace( "trying" );
var b:MovieClip = new MovieClip();
b.graphics.beginFill(0xFF0000);
b.graphics.drawRect(0,0,100,80);
b.graphics.endFill();
b.x = 150;
b.y = 150;
addChild(b );
trace("done")
}
ilad = "CITY NAMES....."
ilurl = "CITY URLS....."