需要将flash网站的主面板从左向右移动
该面板位于ActionScript 2.0中。它位于屏幕的左侧,也可以从左向右滑动。我想把它放在右边,然后从右向左滑动 代码如下:需要将flash网站的主面板从左向右移动,flash,actionscript-2,Flash,Actionscript 2,该面板位于ActionScript 2.0中。它位于屏幕的左侧,也可以从左向右滑动。我想把它放在右边,然后从右向左滑动 代码如下: // // INITIAL SETTINGS // spacer = 20; destX = -bg_mc._width+spacer; originX = this._x; import mx.transitions.Tween; import mx.transitions.easing.*; // // OPENING TRANSITION // // You
//
// INITIAL SETTINGS
//
spacer = 20;
destX = -bg_mc._width+spacer;
originX = this._x;
import mx.transitions.Tween;
import mx.transitions.easing.*;
//
// OPENING TRANSITION
//
// You can use custom easing types such as: Back, Bounce, Elastic, Regular, Strong, None
var tweenMenu:Tween = new Tween(this, "_x", Strong.easeOut, destX, destX, 15, false);
openMenu = function () {
trace('openMenu')
tweenMenu.continueTo(0);
};
// Detect mouse position
onMouseMove = function () {
if (this.hitTest(_root._xmouse+1, _root._ymouse, true)) {
activated = true;
if (this._x != 0) {
tweenMenu.continueTo(0);
}
} else {
if (this._x != destX && activated) {
tweenMenu.continueTo(destX);
}
}
};
感谢您的帮助 根据您展示的代码,您需要做的是:
originX
中)李>
destX
变量值更改为所需值(在屏幕右侧)。它可以是直接值,而不是计算值nav_mc
内的代码更改为
//
// INITIAL SETTINGS
//
spacer = 20;
destX = Stage.width-spacer; //closed menu coord depends on your stage size.
originX = Stage.width-bg_mc._width; //closed menu too.
import mx.transitions.Tween;
import mx.transitions.easing.*;
//
// OPENING TRANSITION
//
// You can use custom easing types such as: Back, Bounce, Elastic, Regular, Strong, None
var tweenMenu:Tween = new Tween(this, "_x", Strong.easeOut, destX, destX, 15, false);
openMenu = function () {
trace('openMenu')
tweenMenu.continueTo(originX); //there was mistake. your menu always goes to 0, and originX was
//never used in code
};
// Detect mouse position
onMouseMove = function () {
if (this.hitTest(_root._xmouse+1, _root._ymouse, true)) {
activated = true;
if (this._x != originX) { //same here
tweenMenu.continueTo(originX); //same here
}
} else {
if (this._x != destX && activated) {
tweenMenu.continueTo(destX);
}
}
};
alignObjects=function(){…}
中添加以下行,以便在可能的更改后提供正确的菜单定位:
nav_mc.destX = Stage.width-nav_mc.spacer;
nav_mc.originX = Stage.width-nav_mc.bg_mc._width;
if (nav_mc._x==nav_mc.destX) {
nav_mc.tweenMenu.continueTo(nav_mc.originX);
}else{
nav_mc.tweenMenu.continueTo(nav_mc.destX);
}
相信我,阿斯皮罗,如果我知道怎么做,我就不会在这里问了。我试图在给定的位置进行一些更改,面板飞到了中间。这是消息来源。请看一下,看看出了什么问题。更新了我的答案。看看吧,天哪!非常感谢你,阿斯皮罗先生。你是个超级英雄!