我已经使用 Actionscipt2.0 完成了拖动和匹配 Flash 的内容,但现在我需要将其更改为 3.0。改了之后,flash就不能再拖东西了,有没有人看一下代码,看我是哪部分转换错了。谢谢。
动作脚本 2.0 版本:
stop();
var randomPositionFrame = int(Math.random()*9)+1;
content_mc.gotoAndStop(randomPositionFrame);
for(var i=1; i<=5; i++){
eval("content_mc.matching_term_"+i)._alpha = 0;
eval("content_mc.matching_term_"+i).onPress = function(){
if(this._currentframe == 1){
this.startDrag();
}
}
eval("content_mc.matching_term_"+i).onRelease = onMouseUp = function(){
this.stopDrag();
}
eval("content_mc.matching_desc_"+i)._alpha = 0;
eval("content_mc.matching_desc_"+i).onPress = function(){
if(this._currentframe == 1){
this.startDrag();
}
}
eval("content_mc.matching_desc_"+i).onRelease = onMouseUp = function(){
this.stopDrag();
}
}
动作脚本 3.0 版本:
stop();
var randomPositionFrame = int(Math.random()*9)+1;
content_mc.gotoAndStop(randomPositionFrame);
for(var i=1; i<=5; i++){
this["content_mc.matching_term_"+i]._alpha = 0;
this["content_mc.matching_term_"+i].addEventListener(MouseEvent.MOUSE_DOWN,function():void {
if(this._currentframe == 1){
this.startDrag();
}
}
);
this["content_mc.matching_term_"+i].addEventListener(MouseEvent.MOUSE_UP,function():void {
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0, true);
function doMouseUp($evt:MouseEvent):void
{
this.stopDrag();
}
}
);
this["content_mc.matching_desc_"+i]._alpha = 0;
this["content_mc.matching_term_"+i].addEventListener(MouseEvent.MOUSE_DOWN,function():void {
if(this._currentframe == 1){
this.startDrag();
}
}
);
this["content_mc.matching_desc_"+i].addEventListener(MouseEvent.MOUSE_UP,function():void {
this.stopDrag();
}
);
}