Flash AS2到AS3转换需要帮助,存在重大问题
我有一个项目,我需要更新表AS2到AS3,因为我需要一些新的功能,可用于垂直居中的文本 我目前在时间线上的AS2代码如下Flash AS2到AS3转换需要帮助,存在重大问题,flash,actionscript-3,actionscript-2,Flash,Actionscript 3,Actionscript 2,我有一个项目,我需要更新表AS2到AS3,因为我需要一些新的功能,可用于垂直居中的文本 我目前在时间线上的AS2代码如下 var dataField = _root.dataField; var dataType = _root.dataType; var dataPage = _root.dataPage; var dataVar = _root.dataVar; _root.mc.onRelease = function() { getURL("index.php?page=
var dataField = _root.dataField;
var dataType = _root.dataType;
var dataPage = _root.dataPage;
var dataVar = _root.dataVar;
_root.mc.onRelease = function() {
getURL("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self");
};
import mx.transitions.Tween;
/**
*
* StandardKey is attached to a movieclip in the library.
* It handles the basic button behavior of the keyboard keys.
* When each button is placed on the stage, it's instance name
* will be the unique ID of the key.
*
*/
class StandardKey extends MovieClip {
///////////////////////////////////////
//Stage Elements
var highlight:MovieClip;
//End Stage Elements
var highlightTween:Tween;
function StandardKey(Void) {
//Repaint the key with 0 alpha
highlight._alpha = 0;
}
function onPress(Void):Void {
//Do the highlight animation
highlightTween.stop();
highlightTween = new Tween(highlight, "_alpha", mx.transitions.easing.Regular.easeInOut, 100, 0, 10, false);
}
}
我的外部AS文件如下
var dataField = _root.dataField;
var dataType = _root.dataType;
var dataPage = _root.dataPage;
var dataVar = _root.dataVar;
_root.mc.onRelease = function() {
getURL("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self");
};
import mx.transitions.Tween;
/**
*
* StandardKey is attached to a movieclip in the library.
* It handles the basic button behavior of the keyboard keys.
* When each button is placed on the stage, it's instance name
* will be the unique ID of the key.
*
*/
class StandardKey extends MovieClip {
///////////////////////////////////////
//Stage Elements
var highlight:MovieClip;
//End Stage Elements
var highlightTween:Tween;
function StandardKey(Void) {
//Repaint the key with 0 alpha
highlight._alpha = 0;
}
function onPress(Void):Void {
//Do the highlight animation
highlightTween.stop();
highlightTween = new Tween(highlight, "_alpha", mx.transitions.easing.Regular.easeInOut, 100, 0, 10, false);
}
}
下面是我将时间线和外部AS2移动到AS3的尝试
我现在有:
var dataField = this.dataField;
var dataType = this.dataType;
var dataPage = this.dataPage;
var dataVar = this.dataVar;
var dataNum = this.dataNum;
_root.mc.onRelease = function() {
navigateToURL(new URLRequest("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self"));
};
外部AS3我有
package {
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
/**
*
* StandardKey is attached to a movieclip in the library.
* It handles the basic button behavior of the keyboard keys.
* When each button is placed on the stage, it's instance name
* will be the unique ID of the key.
*
*/
public class StandardKey extends MovieClip {
///////////////////////////////////////
//Stage Elements
var highlight:MovieClip;
//End Stage Elements
var highlightTween:Tween;
public function StandardKey(Void) {
//Repaint the key with 0 alpha
highlight._alpha = 0;
}
public function onPress(Void):void {
//Do the highlight animation
highlightTween.stop();
highlightTween = new Tween(highlight, "_alpha", fl.transitions.easing.Regular.easeInOut, 100, 0, 10, false);
}
}
}
我目前收到的错误有:
场景1,层“标签”,第1帧,第6行1120:访问未定义的属性\u根。
场景1,层“标签”,第1帧,第7行1137:参数数量不正确。预计不超过1
如果有人能帮我解决这个问题,我将非常感激
问候
Mat.不要使用_root,如果您绝对需要向上引用,最接近AS3的等效项是stage DisplayObject属性不再以下划线开头(
\u alpha
vs.alpha
)
您不能使用onRelease,您需要使用addEventListener()
你的时间线代码没有什么意义,为什么你要制作本地变量
总而言之,我建议你仔细阅读 不要使用_root,如果您绝对需要向上引用,最接近AS3的等效项是stage DisplayObject属性不再以下划线开头(
\u alpha
vs.alpha
)
您不能使用onRelease,您需要使用addEventListener()
你的时间线代码没有什么意义,为什么你要制作本地变量
总而言之,我建议你仔细阅读 变化
_root.mc.onRelease = function() {
navigateToURL(new URLRequest("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self"));
}
到
高亮显示。_alpha=0代码>至高亮显示.alpha=0代码>
highlightTween = new Tween(highlight, "_alpha", fl.transitions.easing.Regular.easeInOut, 100, 0, 10, false);
到
改变
_root.mc.onRelease = function() {
navigateToURL(new URLRequest("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self"));
}
到
高亮显示。_alpha=0代码>至高亮显示.alpha=0代码>
highlightTween = new Tween(highlight, "_alpha", fl.transitions.easing.Regular.easeInOut, 100, 0, 10, false);
到
我不太确定你在问什么-如果你发布你收到的错误,或者你在AS3中尝试过的代码,可能会有所帮助,这样我们可以帮助你找出哪里出了问题。嗨,Quoo,我已经在原始帖子的末尾添加了我目前的内容,希望这能提供更多信息。谢谢:)我真的不知道你在问什么-如果你发布你收到的错误,或者你在AS3中尝试的代码,这可能会有所帮助,这样我们可以帮助你找出哪里出了问题。嗨,Quoo,我已经在原始帖子的末尾添加了我目前的内容,希望这能提供更多信息。谢谢:)如果这有点苛刻,我很抱歉,但是你的代码基本上需要完全重写。哦,天哪:(,我想可能是这样的,我尝试在这里和那里更改位以使其在AS3中工作。局部变量作为导航按钮从动态php页面传递到按钮。如果这有点苛刻,我很抱歉,但您的代码基本上需要完全重写。哦,亲爱的:(,我想可能是这样的,我尝试在这里和那里更改位以使其在AS3中工作。局部变量作为导航按钮从动态php页面传递到按钮。