Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 动作脚本2.0到3.0,请帮忙,我转换错了吗?_Actionscript 3_Actionscript_Actionscript 2 - Fatal编程技术网

Actionscript 3 动作脚本2.0到3.0,请帮忙,我转换错了吗?

Actionscript 3 动作脚本2.0到3.0,请帮忙,我转换错了吗?,actionscript-3,actionscript,actionscript-2,Actionscript 3,Actionscript,Actionscript 2,我正在做ActionScript2.0到3.0的工作,但我对3.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

我正在做ActionScript2.0到3.0的工作,但我对3.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();
}
}

var winGame = false;
var alphaSpeed = 20;
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function () { this.isDown = true;};
mouseListener.onMouseUp = function () {
this.isDown = false;
//Game Logic Check Correct
for(var i=1; i<=5; i++){
    //term match description
    if(eval("content_mc.matching_desc_"+i).mc._currentframe == 2 && eval("content_mc.matching_term_"+i).mc._currentframe == 2){
        if(eval("content_mc.matching_term_"+i)._currentframe == 1){
            eval("content_mc.matching_term_"+i).gotoAndPlay(2);
            eval("content_mc.matching_desc_"+i).gotoAndPlay(2);
        }
    }
    //description match term
    else if(eval("content_mc.matching_desc_"+i).mc._currentframe == 2 && eval("content_mc.matching_term_"+i).mc._currentframe == 2){
        if(eval("content_mc.matching_desc_"+i)._currentframe == 1){
            eval("content_mc.matching_term_"+i).gotoAndPlay(2);
            eval("content_mc.matching_desc_"+i).gotoAndPlay(2);
        }
    }
}
stop();
var randomPositionFrame=int(Math.random()*9)+1;
内容_mc.gotoAndStop(随机位置帧);
对于(变量i=1;i=100){
如果(内容匹配项3.\uα<100){
内容匹配项3.\u alpha+=alphaSpeed;
}
}
如果(内容匹配项3.\u alpha>=100){
如果(内容匹配项4.\uα<100){
内容匹配项4.α+=α速度;
}
}
如果(内容匹配项4.\u alpha>=100){
如果(内容匹配项5.\uα<100){
内容匹配项5.α+=α速度;
}
}
//开始时显示说明
如果(内容匹配项5.\u alpha>=100){
如果(内容匹配描述1.\uα<100){
内容匹配描述1.\u alpha+=alphaSpeed;
}
如果(内容匹配描述1.\u alpha>=100){
if(内容匹配描述2.α<100){
内容匹配描述2.α+=α速度;
}
}
如果(内容匹配描述2.\u alpha>=100){
if(内容匹配描述3.α<100){
内容匹配描述3.α+=α速度;
}
}
如果(内容匹配描述3.\u alpha>=100){
if(内容匹配描述4.α<100){
内容匹配描述4.α+=α速度;
}
}
如果(内容匹配描述4.\u alpha>=100){
如果(内容匹配描述5.α<100){
内容匹配描述5.α+=α速度;
}
}
/*如果(内容匹配描述5.\u alpha>=100){
删除此.onEnterFrame;
}*/
}
//翻滚效应
对于(变量i=1;i=100){
如果(内容匹配描述1.\uα<100){
内容匹配描述1.\u alpha+=alphaSpeed;
}
如果(内容匹配描述1.\u alpha>=100){
if(内容匹配描述2.α<100){
内容匹配描述2.α+=α速度;
}
}
如果(内容匹配描述2.\u alpha>=100){
if(内容匹配描述3.α<100){
内容匹配描述3.α+=α速度;
}
}
如果(内容匹配描述3.\u alpha>=100){
if(内容匹配描述4.α<100){
内容匹配描述4.α+=α速度;
}
}
如果(内容匹配描述4.\u alpha>=100){
如果(内容匹配描述5.α<100){
内容匹配描述5.α+=α速度;
}
}
/*如果(内容匹配描述5.\u alpha>=100){
删除此.onEnterFrame;
}*/
}
//翻滚效应

对于(var i=1;i当然,这个问题并不专业,也没有人愿意为您做这样枯燥的工作。您必须阅读一些关于从as2迁移到as3的文章。我完成了您的工作,因为它很简单,而且我有时间,希望它会有所帮助,您下次也会自己做

stop();
var randomPositionFrame = int(Math.random()*9)+1;
content_mc.gotoAndStop(randomPositionFrame);
for(var i=1; i<=5; i++){
content_mc["matching_term_"+i].alpha = 0;
content_mc["matching_term_"+i].addEventListener(MouseEvent.MOUSE_DOWN,function(e:MouseEvent):void     {
if(content_mc.currentFrame == 1){
        e.target.startDrag();
    }
}
);
content_mc["matching_term_"+i].addEventListener(MouseEvent.MOUSE_UP,function(e:MouseEvent):void {
    stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0,     true);
});

content_mc["matching_desc_"+i].alpha = 0;
content_mc["matching_desc_"+i].addEventListener(MouseEvent.MOUSE_DOWN,function(e:MouseEvent):void     {
if(content_mc.currentFrame == 1){
        e.target.startDrag();
    }
}
);

content_mc["matching_desc_"+i].addEventListener(MouseEvent.MOUSE_UP,function(e:MouseEvent):void {
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0, true);     
}
);
}

function doMouseUp(e:MouseEvent):void
{
e.target.stopDrag();
}

var winGame = false;
var alphaSpeed = 20;

addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent) { this.isDown = true;});
addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent) { this.isDown = false;});

//Game Logic Check Correct
for(var k=1; k<=5; k++){
    //term match description
    if(content_mc["matching_desc_"+k].mc.currentFrame == 2 &&     content_mc["matching_term_"+k].mc.currentFrame == 2){
        if(content_mc["matching_term_"+k].currentFrame == 1){
            content_mc["matching_term_"+k].gotoAndPlay(2);
            content_mc["matching_desc_"+k].gotoAndPlay(2);
        }
    }
    //description match term
    else if(content_mc["matching_desc_"+k].mc.currentFrame == 2 && content_mc["matching_term_"+k].mc.currentFrame == 2){
        if(content_mc["matching_desc_"+k].currentFrame == 1){
            content_mc["matching_term_"+k].gotoAndPlay(2);
            content_mc["matching_desc_"+k].gotoAndPlay(2);
        }
    }
}

this.addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
//display terms at start
if(content_mc.matching_term_1.alpha < 100){
    content_mc.matching_term_1.alpha +=alphaSpeed;
}
if(content_mc.matching_term_1.alpha >= 100){
    if(content_mc.matching_term_2.alpha < 100){
        content_mc.matching_term_2.alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_2.alpha >= 100){
    if(content_mc.matching_term_3.alpha < 100){
        content_mc.matching_term_3.alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_3.alpha >= 100){
    if(content_mc.matching_term_4.alpha < 100){
        content_mc.matching_term_4.alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_4.alpha >= 100){
    if(content_mc.matching_term_5.alpha < 100){
        content_mc.matching_term_5.alpha +=alphaSpeed;
    }
}
//display description at start
if(content_mc.matching_term_5.alpha >= 100){
    if(content_mc.matching_desc_1.alpha < 100){
        content_mc.matching_desc_1.alpha +=alphaSpeed;
    }
    if(content_mc.matching_desc_1.alpha >= 100){
        if(content_mc.matching_desc_2.alpha < 100){
            content_mc.matching_desc_2.alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_2.alpha >= 100){
        if(content_mc.matching_desc_3.alpha < 100){
            content_mc.matching_desc_3.alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_3.alpha >= 100){
        if(content_mc.matching_desc_4.alpha < 100){
            content_mc.matching_desc_4.alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_4.alpha >= 100){
        if(content_mc.matching_desc_5.alpha < 100){
            content_mc.matching_desc_5.alpha +=alphaSpeed;
        }
    }
    /*if(content_mc.matching_desc_5.alpha >= 100){
        delete this.onEnterFrame;
    }*/
}

//Roll over effect
for(var i=1; i<=5; i++){
    if(content_mc["matching_term_"+i].hitTestPoint(mouseX, mouseY)){
        content_mc["matching_term_"+i].mc.gotoAndStop(2);
    }
    else{
        content_mc["matching_term_"+i].mc.gotoAndStop(1);
    }
    if(content_mc["matching_desc_"+i].hitTestPoint(mouseX, mouseY)){
        content_mc["matching_desc_"+i].mc.gotoAndStop(2);
    }
    else{
        content_mc["matching_desc_"+i].mc.gotoAndStop(1);
    }
}

//remove the matched movieclips
for(var a=1; a<=5; a++){
    if(content_mc["matching_term_"+a].currentFrame == 10){
        content_mc["matching_term_"+a].y = -1000;
    }
    if(content_mc["matching_desc_"+a].currentFrame == 10){
        content_mc["matching_desc_"+a].y = -1000;
    }
}

//Win Game
for(var n=1; n<=5; n++){
    if(content_mc["matching_desc_"+n].currentFrame == 10){
        winGame = true;
    }
    else{
        winGame = false;
        return;
    }
}
if(winGame == true){
    this.gotoAndPlay("endRound1");
}
}
stop();
var randomPositionFrame=int(Math.random()*9)+1;
内容_mc.gotoAndStop(随机位置帧);
对于(变量i=1;i=100){
如果(内容匹配项α<100){
内容匹配术语α+=α速度;
}
}
如果(内容匹配术语α>=100){
如果(内容匹配项α<100){
内容匹配项α+=α速度;
}
}
如果(内容匹配项α>=100){
如果(内容匹配项5α<100){
内容匹配术语α+=α速度;
}
}
//开始时显示说明
如果(内容匹配项α>=100){
如果(内容匹配描述1α<100){
内容匹配描述1.alpha+=alphaSpeed;
}
如果(内容匹配描述1.alpha>=100){
如果(内容匹配描述2.alpha<100){
内容匹配描述2阿尔法+=阿尔法速度;
}
}
如果(内容匹配描述2.alpha>=100){
如果(内容匹配描述3.alpha<100){
内容匹配描述3.alpha+=alphaSpeed;
}
}
如果(内容匹配描述3.alpha>=100){
如果(内容匹配描述4.alpha<100){
内容匹配描述4.alpha+=alphaSpeed;
}
}
如果(内容匹配描述4.alpha>=100){
如果(内容匹配描述5.alpha<100){
内容匹配描述5.alpha+=alphaSpeed;
}
}
/*如果(内容匹配描述5.alpha>=100){
删除此.onEnterFrame;
}*/
}
//翻滚效应

对于(var i=1;我尝试过什么吗?是的,我已将我的问题和工作从2.0更新到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);              

);

this["content_mc.matching_desc_"+i]._alpha = 0;
        this["content_mc.matching_desc_"+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 {
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0, true);     
}
);
}

function doMouseUp($evt:MouseEvent):void
{
this.stopDrag();
}

var winGame = false;
var alphaSpeed = 20;
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function () { this.isDown = true;};
mouseListener.onMouseUp = function () {
this.isDown = false;
//Game Logic Check Correct
for(var k=1; k<=5; k++){
    //term match description
    if(this["content_mc.matching_desc_"+k].mc._currentframe == 2 &&     this["content_mc.matching_term_"+k].mc._currentframe == 2){
        if(this["content_mc.matching_term_"+k]._currentframe == 1){
            this["content_mc.matching_term_"+k].gotoAndPlay(2);
            this["content_mc.matching_desc_"+k].gotoAndPlay(2);
        }
    }
    //description match term
    else if(this["content_mc.matching_desc_"+k].mc._currentframe == 2 && this["content_mc.matching_term_"+k].mc._currentframe == 2){
        if(this["content_mc.matching_desc_"+k]._currentframe == 1){
            this["content_mc.matching_term_"+k].gotoAndPlay(2);
            this["content_mc.matching_desc_"+k].gotoAndPlay(2);
        }
    }
}

};
this.Mouse.addListener(mouseListener);

this.addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
//display terms at start
if(content_mc.matching_term_1._alpha < 100){
    content_mc.matching_term_1._alpha +=alphaSpeed;
}
if(content_mc.matching_term_1._alpha >= 100){
    if(content_mc.matching_term_2._alpha < 100){
        content_mc.matching_term_2._alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_2._alpha >= 100){
    if(content_mc.matching_term_3._alpha < 100){
        content_mc.matching_term_3._alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_3._alpha >= 100){
    if(content_mc.matching_term_4._alpha < 100){
        content_mc.matching_term_4._alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_4._alpha >= 100){
    if(content_mc.matching_term_5._alpha < 100){
        content_mc.matching_term_5._alpha +=alphaSpeed;
    }
}
//display description at start
if(content_mc.matching_term_5._alpha >= 100){
    if(content_mc.matching_desc_1._alpha < 100){
        content_mc.matching_desc_1._alpha +=alphaSpeed;
    }
    if(content_mc.matching_desc_1._alpha >= 100){
        if(content_mc.matching_desc_2._alpha < 100){
            content_mc.matching_desc_2._alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_2._alpha >= 100){
        if(content_mc.matching_desc_3._alpha < 100){
            content_mc.matching_desc_3._alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_3._alpha >= 100){
        if(content_mc.matching_desc_4._alpha < 100){
            content_mc.matching_desc_4._alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_4._alpha >= 100){
        if(content_mc.matching_desc_5._alpha < 100){
            content_mc.matching_desc_5._alpha +=alphaSpeed;
        }
    }
    /*if(content_mc.matching_desc_5._alpha >= 100){
        delete this.onEnterFrame;
    }*/
}

//Roll over effect
for(var i=1; i<=5; i++){
    if(this["content_mc.matching_term_"+i].hitTest(mouseX, mouseY)){
        this["content_mc.matching_term_"+i].mc.gotoAndStop(2);
    }
    else{
        this["content_mc.matching_term_"+i].mc.gotoAndStop(1);
    }
    if(this["content_mc.matching_desc_"+i].hitTest(mouseX, mouseY)){
        this["content_mc.matching_desc_"+i].mc.gotoAndStop(2);
    }
    else{
        this["content_mc.matching_desc_"+i].mc.gotoAndStop(1);
    }
}

//remove the matched movieclips
for(var a=1; a<=5; a++){
    if(this["content_mc.matching_term_"+a]._currentframe == 10){
        this["content_mc.matching_term_"+a]._y = -1000;
    }
    if(this["content_mc.matching_desc_"+a]._currentframe == 10){
        this["content_mc.matching_desc_"+a]._y = -1000;
    }
}

//Win Game
for(var n=1; n<=5; n++){
    if(this["content_mc.matching_desc_"+n]._currentframe == 10){
        winGame = true;
    }
    else{
        winGame = false;
        return;
    }
}
if(winGame == true){
    this.gotoAndPlay("endRound1");
}
}
stop();
var randomPositionFrame = int(Math.random()*9)+1;
content_mc.gotoAndStop(randomPositionFrame);
for(var i=1; i<=5; i++){
content_mc["matching_term_"+i].alpha = 0;
content_mc["matching_term_"+i].addEventListener(MouseEvent.MOUSE_DOWN,function(e:MouseEvent):void     {
if(content_mc.currentFrame == 1){
        e.target.startDrag();
    }
}
);
content_mc["matching_term_"+i].addEventListener(MouseEvent.MOUSE_UP,function(e:MouseEvent):void {
    stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0,     true);
});

content_mc["matching_desc_"+i].alpha = 0;
content_mc["matching_desc_"+i].addEventListener(MouseEvent.MOUSE_DOWN,function(e:MouseEvent):void     {
if(content_mc.currentFrame == 1){
        e.target.startDrag();
    }
}
);

content_mc["matching_desc_"+i].addEventListener(MouseEvent.MOUSE_UP,function(e:MouseEvent):void {
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0, true);     
}
);
}

function doMouseUp(e:MouseEvent):void
{
e.target.stopDrag();
}

var winGame = false;
var alphaSpeed = 20;

addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent) { this.isDown = true;});
addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent) { this.isDown = false;});

//Game Logic Check Correct
for(var k=1; k<=5; k++){
    //term match description
    if(content_mc["matching_desc_"+k].mc.currentFrame == 2 &&     content_mc["matching_term_"+k].mc.currentFrame == 2){
        if(content_mc["matching_term_"+k].currentFrame == 1){
            content_mc["matching_term_"+k].gotoAndPlay(2);
            content_mc["matching_desc_"+k].gotoAndPlay(2);
        }
    }
    //description match term
    else if(content_mc["matching_desc_"+k].mc.currentFrame == 2 && content_mc["matching_term_"+k].mc.currentFrame == 2){
        if(content_mc["matching_desc_"+k].currentFrame == 1){
            content_mc["matching_term_"+k].gotoAndPlay(2);
            content_mc["matching_desc_"+k].gotoAndPlay(2);
        }
    }
}

this.addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
//display terms at start
if(content_mc.matching_term_1.alpha < 100){
    content_mc.matching_term_1.alpha +=alphaSpeed;
}
if(content_mc.matching_term_1.alpha >= 100){
    if(content_mc.matching_term_2.alpha < 100){
        content_mc.matching_term_2.alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_2.alpha >= 100){
    if(content_mc.matching_term_3.alpha < 100){
        content_mc.matching_term_3.alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_3.alpha >= 100){
    if(content_mc.matching_term_4.alpha < 100){
        content_mc.matching_term_4.alpha +=alphaSpeed;
    }
}
if(content_mc.matching_term_4.alpha >= 100){
    if(content_mc.matching_term_5.alpha < 100){
        content_mc.matching_term_5.alpha +=alphaSpeed;
    }
}
//display description at start
if(content_mc.matching_term_5.alpha >= 100){
    if(content_mc.matching_desc_1.alpha < 100){
        content_mc.matching_desc_1.alpha +=alphaSpeed;
    }
    if(content_mc.matching_desc_1.alpha >= 100){
        if(content_mc.matching_desc_2.alpha < 100){
            content_mc.matching_desc_2.alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_2.alpha >= 100){
        if(content_mc.matching_desc_3.alpha < 100){
            content_mc.matching_desc_3.alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_3.alpha >= 100){
        if(content_mc.matching_desc_4.alpha < 100){
            content_mc.matching_desc_4.alpha +=alphaSpeed;
        }
    }
    if(content_mc.matching_desc_4.alpha >= 100){
        if(content_mc.matching_desc_5.alpha < 100){
            content_mc.matching_desc_5.alpha +=alphaSpeed;
        }
    }
    /*if(content_mc.matching_desc_5.alpha >= 100){
        delete this.onEnterFrame;
    }*/
}

//Roll over effect
for(var i=1; i<=5; i++){
    if(content_mc["matching_term_"+i].hitTestPoint(mouseX, mouseY)){
        content_mc["matching_term_"+i].mc.gotoAndStop(2);
    }
    else{
        content_mc["matching_term_"+i].mc.gotoAndStop(1);
    }
    if(content_mc["matching_desc_"+i].hitTestPoint(mouseX, mouseY)){
        content_mc["matching_desc_"+i].mc.gotoAndStop(2);
    }
    else{
        content_mc["matching_desc_"+i].mc.gotoAndStop(1);
    }
}

//remove the matched movieclips
for(var a=1; a<=5; a++){
    if(content_mc["matching_term_"+a].currentFrame == 10){
        content_mc["matching_term_"+a].y = -1000;
    }
    if(content_mc["matching_desc_"+a].currentFrame == 10){
        content_mc["matching_desc_"+a].y = -1000;
    }
}

//Win Game
for(var n=1; n<=5; n++){
    if(content_mc["matching_desc_"+n].currentFrame == 10){
        winGame = true;
    }
    else{
        winGame = false;
        return;
    }
}
if(winGame == true){
    this.gotoAndPlay("endRound1");
}
}