我有一张由里面的 MovieClip 城市组成的地图,我在地图 MovieClip 的顶层有一个点击功能。如果我单击一个城市,我会尝试这样做,将绘制一个矩形。这是代码:
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")
}
执行跟踪命令但不绘制矩形。我试过MovieClip( root ).addChild..., stage.addChild..., MovieClip( parent ).addChild...
了,其他人...
你有什么主意吗?谢谢!
完整代码:
双击地图MovieClip->84层欢迎我们->选择名为“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....."