问题在于添加i
. 我试过了++i
,我也试过i=i+1
了i.tostring()
,i++
但我仍然得到输出
击中!1
我如何增加i
?
这是我的代码:
function mousePosition(inputEvent:MouseEvent)
{
var i:Number = 0;
var smiley:MovieClip = new Smiley();
smiley.x = inputEvent.stageX;
smiley.y = inputEvent.stageY;
smiley.addEventListener(Event.ENTER_FRAME, smileyEnterFrame, false, 0, true);
this.addChild(smiley);
// ****************************** BELOW IS THE PROBLEM ******
if (smiley.hitTestObject(RoundButton1) == true)
{i=i+1;
trace("hitting!"+ i);
}
}