我做的ActionScript 2.0到3.0的工作,但我很少有想法的3.0,有人可以好人的帮助,使一个翻译请! 我曾试图完成一个版本,但我的工作就是不能被拖ñ下降改变$ C $后CS。
停止();
VAR randomPositionFrame = INT(的Math.random()* 9)+1;
content_mc.gotoAndStop(randomPositionFrame);
对于(VAR I = 1; I< = 5;我++){
的eval(content_mc.matching_term _+ I)._阿尔法= 0;
的eval(content_mc.matching_term _+ I)。在preSS =功能(){
如果(this._currentframe == 1){
this.startDrag();
}
}
的eval(content_mc.matching_term _+ I).onRelease = onMouseUp =功能(){
this.stopDrag();
}
的eval(content_mc.matching_desc _+ I)._阿尔法= 0;
的eval(content_mc.matching_desc _+ I)。在preSS =功能(){
如果(this._currentframe == 1){
this.startDrag();
}
}
的eval(content_mc.matching_desc _+ I).onRelease = onMouseUp =功能(){
this.stopDrag();
}
}
VAR winGame = FALSE;
VAR alphaSpeed = 20;
VAR的MouseListener:对象=新的对象();
mouseListener.onMouseDown =功能(){this.isDown = TRUE;};
mouseListener.onMouseUp =功能(){
this.isDown = FALSE;
//游戏逻辑检查正确
对于(VAR I = 1; I< = 5;我++){
//期限匹配的说明
如果(EVAL(content_mc.matching_desc _+ⅰ).mc._currentframe == 2&安培;&安培;的eval(content_mc.matching_term _+ⅰ).mc._currentframe == 2){
如果(EVAL(content_mc.matching_term _+ⅰ)._ currentframe == 1){
的eval(content_mc.matching_term _+ⅰ).gotoAndPlay(2);
的eval(content_mc.matching_desc _+ⅰ).gotoAndPlay(2);
}
}
//描述相符术语
否则如果(EVAL(content_mc.matching_desc _+ⅰ).mc._currentframe == 2&安培;&安培;的eval(content_mc.matching_term _+ⅰ).mc._currentframe == 2){
如果(EVAL(content_mc.matching_desc _+ⅰ)._ currentframe == 1){
的eval(content_mc.matching_term _+ⅰ).gotoAndPlay(2);
的eval(content_mc.matching_desc _+ⅰ).gotoAndPlay(2);
}
}
}
}; Mouse.addListener(在MouseListener);
this.onEnterFrame =功能(){
//显示方面为启动
如果(content_mc.matching_term_1._alpha&小于100){
content_mc.matching_term_1._alpha + = alphaSpeed;
}
如果(content_mc.matching_term_1._alpha> = 100){
如果(content_mc.matching_term_2._alpha&小于100){
content_mc.matching_term_2._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_2._alpha> = 100){
如果(content_mc.matching_term_3._alpha&小于100){
content_mc.matching_term_3._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_3._alpha> = 100){
如果(content_mc.matching_term_4._alpha&小于100){
content_mc.matching_term_4._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_4._alpha> = 100){
如果(content_mc.matching_term_5._alpha&小于100){
content_mc.matching_term_5._alpha + = alphaSpeed;
}
}
在启动//显示说明
如果(content_mc.matching_term_5._alpha> = 100){
如果(content_mc.matching_desc_1._alpha&小于100){
content_mc.matching_desc_1._alpha + = alphaSpeed;
}
如果(content_mc.matching_desc_1._alpha> = 100){
如果(content_mc.matching_desc_2._alpha&小于100){
content_mc.matching_desc_2._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_2._alpha> = 100){
如果(content_mc.matching_desc_3._alpha&小于100){
content_mc.matching_desc_3._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_3._alpha> = 100){
如果(content_mc.matching_desc_4._alpha&小于100){
content_mc.matching_desc_4._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_4._alpha> = 100){
如果(content_mc.matching_desc_5._alpha&小于100){
content_mc.matching_desc_5._alpha + = alphaSpeed;
}
}
/*if(content_mc.matching_desc_5._alpha> = 100){
删除this.onEnterFrame;
} * /
}
//翻滚效果
对于(VAR I = 1; I< = 5;我++){
如果(的eval(content_mc.matching_term _+ I).hitTest(this._xmouse,this._ymouse)){
的eval(content_mc.matching_term _+ⅰ).mc.gotoAndStop(2);
}
其他{
的eval(content_mc.matching_term _+ⅰ).mc.gotoAndStop(1);
}
如果(的eval(content_mc.matching_desc _+ I).hitTest(this._xmouse,this._ymouse)){
的eval(content_mc.matching_desc _+ⅰ).mc.gotoAndStop(2);
}
其他{
的eval(content_mc.matching_desc _+ⅰ).mc.gotoAndStop(1);
}
}
//删除匹配的影片剪辑
对于(VAR I = 1; I< = 5;我++){
如果(的eval(content_mc.matching_term _+ I)._ currentframe == 10){
的eval(content_mc.matching_term _+ I)._ Y = -1000;
}
如果(的eval(content_mc.matching_desc _+ I)._ currentframe == 10){
的eval(content_mc.matching_desc _+ I)._ Y = -1000;
}
}
//赢取游戏
对于(VAR I = 1; I< = 5;我++){
如果(的eval(content_mc.matching_desc _+ I)._ currentframe == 10){
winGame = TRUE;
}
其他{
winGame = FALSE;
返回;
}
}
如果(winGame ==真){
this.gotoAndPlay(endRound1);
}
}
我也做了3.0这样的:(但原来,我不能这样做的阻力ñ下降)
停止();
VAR randomPositionFrame = INT(的Math.random()* 9)+1;
content_mc.gotoAndStop(randomPositionFrame);
对于(VAR I = 1; I< = 5;我++){
这种[content_mc.matching_term _+ i] ._阿尔法= 0;
这种[content_mc.matching_term _+ I] .addEventListener(的MouseEvent.MOUSE_DOWN,函数():无效{
如果(this._currentframe == 1){
this.startDrag();
}
}
);
这种[content_mc.matching_term _+ I] .addEventListener(侦听MouseEvent.MOUSE_UP,函数():无效{
stage.addEventListener(侦听MouseEvent.MOUSE_UP,doMouseUp,假,0,真正的);
);
这种[content_mc.matching_desc _+ i] ._阿尔法= 0;
这种[content_mc.matching_desc _+ I] .addEventListener(的MouseEvent.MOUSE_DOWN,函数():无效{
如果(this._currentframe == 1){
this.startDrag();
}
}
);
这种[content_mc.matching_desc _+ I] .addEventListener(侦听MouseEvent.MOUSE_UP,函数():无效{
stage.addEventListener(侦听MouseEvent.MOUSE_UP,doMouseUp,假,0,真正的);
}
);
}
功能doMouseUp($ EVT:MouseEvent)方法:无效
{
this.stopDrag();
}
VAR winGame = FALSE;
VAR alphaSpeed = 20;
VAR的MouseListener:对象=新的对象();
mouseListener.onMouseDown =功能(){this.isDown = TRUE;};
mouseListener.onMouseUp =功能(){
this.isDown = FALSE;
//游戏逻辑检查正确
对于(VAR K = 1; K< = 5; k ++){
//期限匹配的说明
如果(此[content_mc.matching_desc _+ k]的.mc._currentframe == 2&安培;&安培;这里[content_mc.matching_term _+ K] .mc._currentframe == 2){
如果(这[content_mc.matching_term _+ K] ._ currentframe == 1){
这[content_mc.matching_term _+ k]的.gotoAndPlay(2);
这[content_mc.matching_desc _+ k]的.gotoAndPlay(2);
}
}
//描述相符术语
否则如果(此[content_mc.matching_desc _+ k]的.mc._currentframe == 2&安培;&安培;这里[content_mc.matching_term _+ k]的.mc._currentframe == 2){
如果(这[content_mc.matching_desc _+ K] ._ currentframe == 1){
这[content_mc.matching_term _+ k]的.gotoAndPlay(2);
这[content_mc.matching_desc _+ k]的.gotoAndPlay(2);
}
}
}
};
this.Mouse.addListener(在MouseListener);
this.addEventListener(Event.ENTER_FRAME,myFunction的);
函数myFunction的(事件:事件){
//显示方面为启动
如果(content_mc.matching_term_1._alpha&小于100){
content_mc.matching_term_1._alpha + = alphaSpeed;
}
如果(content_mc.matching_term_1._alpha> = 100){
如果(content_mc.matching_term_2._alpha&小于100){
content_mc.matching_term_2._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_2._alpha> = 100){
如果(content_mc.matching_term_3._alpha&小于100){
content_mc.matching_term_3._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_3._alpha> = 100){
如果(content_mc.matching_term_4._alpha&小于100){
content_mc.matching_term_4._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_4._alpha> = 100){
如果(content_mc.matching_term_5._alpha&小于100){
content_mc.matching_term_5._alpha + = alphaSpeed;
}
}
在启动//显示说明
如果(content_mc.matching_term_5._alpha> = 100){
如果(content_mc.matching_desc_1._alpha&小于100){
content_mc.matching_desc_1._alpha + = alphaSpeed;
}
如果(content_mc.matching_desc_1._alpha> = 100){
如果(content_mc.matching_desc_2._alpha&小于100){
content_mc.matching_desc_2._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_2._alpha> = 100){
如果(content_mc.matching_desc_3._alpha&小于100){
content_mc.matching_desc_3._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_3._alpha> = 100){
如果(content_mc.matching_desc_4._alpha&小于100){
content_mc.matching_desc_4._alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_4._alpha> = 100){
如果(content_mc.matching_desc_5._alpha&小于100){
content_mc.matching_desc_5._alpha + = alphaSpeed;
}
}
/*if(content_mc.matching_desc_5._alpha> = 100){
删除this.onEnterFrame;
} * /
}
//翻滚效果
对于(VAR I = 1; I< = 5;我++){
如果(这[content_mc.matching_term _+ I] .hitTest(mouseX,mouseY的)){
这种[content_mc.matching_term _+ I] .mc.gotoAndStop(2);
}
其他{
这种[content_mc.matching_term _+ I] .mc.gotoAndStop(1);
}
如果(这[content_mc.matching_desc _+ I] .hitTest(mouseX,mouseY的)){
这种[content_mc.matching_desc _+ I] .mc.gotoAndStop(2);
}
其他{
这种[content_mc.matching_desc _+ I] .mc.gotoAndStop(1);
}
}
//删除匹配的影片剪辑
对于(VAR一个= 1; A< = 5; A ++){
如果(这[content_mc.matching_term _+一] ._ currentframe == 10){
这种[content_mc.matching_term _+一] ._ Y = -1000;
}
如果(这[content_mc.matching_desc _+一] ._ currentframe == 10){
这种[content_mc.matching_desc _+一] ._ Y = -1000;
}
}
//赢取游戏
对于(VAR N = 1; N< = 5; N ++){
如果(这[content_mc.matching_desc _+ N] ._ currentframe == 10){
winGame = TRUE;
}
其他{
winGame = FALSE;
返回;
}
}
如果(winGame ==真){
this.gotoAndPlay(endRound1);
}
}
解决方案
当然,问题不专业,没有人愿意为你做这样无趣的工作。你必须阅读一些文章从AS2迁移到AS3。我做你的工作,因为它很容易,我有时间,希望它会帮助你将自己下一次做到这一点。
停止();
VAR randomPositionFrame = INT(的Math.random()* 9)+1;
content_mc.gotoAndStop(randomPositionFrame);
对于(VAR I = 1; I< = 5;我++){
content_mc [matching_term _+ I]阿尔法= 0;
content_mc [matching_term _+ I] .addEventListener(的MouseEvent.MOUSE_DOWN,功能(E:的MouseEvent):无效{
如果(content_mc.currentFrame == 1){
e.target.startDrag();
}
}
);
content_mc [matching_term _+ I] .addEventListener(侦听MouseEvent.MOUSE_UP,功能(E:的MouseEvent):无效{
stage.addEventListener(侦听MouseEvent.MOUSE_UP,doMouseUp,假,0,真正的);
});
content_mc [matching_desc _+ I]阿尔法= 0;
content_mc [matching_desc _+ I] .addEventListener(的MouseEvent.MOUSE_DOWN,功能(E:的MouseEvent):无效{
如果(content_mc.currentFrame == 1){
e.target.startDrag();
}
}
);
content_mc [matching_desc _+ I] .addEventListener(侦听MouseEvent.MOUSE_UP,功能(E:的MouseEvent):无效{
stage.addEventListener(侦听MouseEvent.MOUSE_UP,doMouseUp,假,0,真正的);
}
);
}
功能doMouseUp(E:MouseEvent)方法:无效
{
e.target.stopDrag();
}
VAR winGame = FALSE;
VAR alphaSpeed = 20;
的addEventListener(的MouseEvent.MOUSE_DOWN,功能(E:的MouseEvent){this.isDown = TRUE;});
的addEventListener(侦听MouseEvent.MOUSE_UP,功能(E:的MouseEvent){this.isDown = FALSE;});
//游戏逻辑检查正确
对于(VAR K = 1; K< = 5; k ++){
//期限匹配的说明
如果(content_mc [matching_desc _+ k]的.mc.currentFrame == 2&安培;&安培; content_mc [matching_term _+ k]的.mc.currentFrame == 2){
如果(content_mc [matching_term _+ k]的.currentFrame == 1){
content_mc [matching_term _+ k]的.gotoAndPlay(2);
content_mc [matching_desc _+ k]的.gotoAndPlay(2);
}
}
//描述相符术语
否则如果(content_mc [matching_desc _+ k]的.mc.currentFrame == 2&安培;&安培; content_mc [matching_term _+ k]的.mc.currentFrame == 2){
如果(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的);
函数myFunction的(事件:事件){
//显示方面为启动
如果(content_mc.matching_term_1.alpha&小于100){
content_mc.matching_term_1.alpha + = alphaSpeed;
}
如果(content_mc.matching_term_1.alpha> = 100){
如果(content_mc.matching_term_2.alpha&小于100){
content_mc.matching_term_2.alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_2.alpha> = 100){
如果(content_mc.matching_term_3.alpha&小于100){
content_mc.matching_term_3.alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_3.alpha> = 100){
如果(content_mc.matching_term_4.alpha&小于100){
content_mc.matching_term_4.alpha + = alphaSpeed;
}
}
如果(content_mc.matching_term_4.alpha> = 100){
如果(content_mc.matching_term_5.alpha&小于100){
content_mc.matching_term_5.alpha + = alphaSpeed;
}
}
在启动//显示说明
如果(content_mc.matching_term_5.alpha> = 100){
如果(content_mc.matching_desc_1.alpha&小于100){
content_mc.matching_desc_1.alpha + = alphaSpeed;
}
如果(content_mc.matching_desc_1.alpha> = 100){
如果(content_mc.matching_desc_2.alpha&小于100){
content_mc.matching_desc_2.alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_2.alpha> = 100){
如果(content_mc.matching_desc_3.alpha&小于100){
content_mc.matching_desc_3.alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_3.alpha> = 100){
如果(content_mc.matching_desc_4.alpha&小于100){
content_mc.matching_desc_4.alpha + = alphaSpeed;
}
}
如果(content_mc.matching_desc_4.alpha> = 100){
如果(content_mc.matching_desc_5.alpha&小于100){
content_mc.matching_desc_5.alpha + = alphaSpeed;
}
}
/*if(content_mc.matching_desc_5.alpha> = 100){
删除this.onEnterFrame;
} * /
}
//翻滚效果
对于(VAR I = 1; I< = 5;我++){
如果(content_mc [matching_term _+ I] .hitTestPoint(mouseX,mouseY的)){
content_mc [matching_term _+ I] .mc.gotoAndStop(2);
}
其他{
content_mc [matching_term _+ i]于.mc.gotoAndStop(1);
}
如果(content_mc [matching_desc _+ I] .hitTestPoint(mouseX,mouseY的)){
content_mc [matching_desc _+ I] .mc.gotoAndStop(2);
}
其他{
content_mc [matching_desc _+ i]于.mc.gotoAndStop(1);
}
}
//删除匹配的影片剪辑
对于(VAR一个= 1; A< = 5; A ++){
如果(content_mc [matching_term _+一] .currentFrame == 10){
content_mc [matching_term _+一] .Y = -1000;
}
如果(content_mc [matching_desc _+一] .currentFrame == 10){
content_mc [matching_desc _+一] .Y = -1000;
}
}
//赢取游戏
对于(VAR N = 1; N< = 5; N ++){
如果(content_mc [matching_desc _+ N] .currentFrame == 10){
winGame = TRUE;
}
其他{
winGame = FALSE;
返回;
}
}
如果(winGame ==真){
this.gotoAndPlay(endRound1);
}
}
I'm doing the Actionscript 2.0 to 3.0 work but I have very few idea on 3.0, Can somebody good guys help to make a translate please! I have try to finish a version but my work just cannot being "drag n drop" after changing the codes.
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);
}
}
}
}; Mouse.addListener(mouseListener);
this.onEnterFrame = function(){
//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(eval("content_mc.matching_term_"+i).hitTest(this._xmouse, this._ymouse)){
eval("content_mc.matching_term_"+i).mc.gotoAndStop(2);
}
else{
eval("content_mc.matching_term_"+i).mc.gotoAndStop(1);
}
if(eval("content_mc.matching_desc_"+i).hitTest(this._xmouse, this._ymouse)){
eval("content_mc.matching_desc_"+i).mc.gotoAndStop(2);
}
else{
eval("content_mc.matching_desc_"+i).mc.gotoAndStop(1);
}
}
//remove the matched movieclips
for(var i=1; i<=5; i++){
if(eval("content_mc.matching_term_"+i)._currentframe == 10){
eval("content_mc.matching_term_"+i)._y = -1000;
}
if(eval("content_mc.matching_desc_"+i)._currentframe == 10){
eval("content_mc.matching_desc_"+i)._y = -1000;
}
}
//Win Game
for(var i=1; i<=5; i++){
if(eval("content_mc.matching_desc_"+i)._currentframe == 10){
winGame = true;
}
else{
winGame = false;
return;
}
}
if(winGame == true){
this.gotoAndPlay("endRound1");
}
}
I have done the 3.0 like this: (but turns out the I cannot do the drag n drop)
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");
}
}
解决方案
Of course, question is not professional and nobody wants to do such uninteresting work for you. You have to read some articles for migrating from as2 to as3. I did your work, because it's easy and I had time, hope it will help and you will do it yourself next time.
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");
}
}