我必须更改flash文档中的徽标,但它在actionscript 2代码中,因此它会出错。当我尝试你保存文件时actionscript 2代码如下。是否有一种简单的方法可以转换为actionscript 3中的代码。 如何将其转换为动作脚本?
function buildMenu(success)
{
if(success)
{
folder = this.firstChild.childNodes;
var i;
i = 0;
while(i < folder.length)
{
var _loc4_ = mainMenu.attachMovie("mainBtn","mainBtn" + i,i + 500);
var _loc7_ = menu_numbers.attachMovie("number","number" + i,i + 550);
_loc4_.btnName.text = folder[i].attributes.NAME;
MenuColor0 = new Color(mainMenu.mainBtn0.bg);
MenuColor0.setRGB(10802437);
MenuColor1 = new Color(mainMenu.mainBtn1.bg);
MenuColor1.setRGB(8633375);
MenuColor2 = new Color(mainMenu.mainBtn2.bg);
MenuColor2.setRGB(5612349);
MenuColor3 = new Color(mainMenu.mainBtn3.bg);
MenuColor3.setRGB(1208203);
MenuColor3._width = 20;
var _loc9_ = menu_numbers.attachMovie("mask","numara_mask" + i,i +
650);
_loc9_._width = 60;
_loc9_._height = 45;
_loc9_._x = _loc9_._x + (menu_numbers["numara_mask" + (i - 1)]._x +
menu_numbers["numara_mask" + (i - 1)]._width + btnSpacing + 65);
_loc9_._y = 15;
_loc7_.setMask(_loc9_);
var _loc10_ = new Color(_loc7_);
_loc10_.setRGB(16777215);
_loc7_._alpha = 40;
_loc4_.link = folder[i].attributes.LINK;
_loc4_.subMenu = folder[i].childNodes.length;
_loc4_._x = _loc4_._x + (mainMenu["mainBtn" + (i - 1)]._x +
mainMenu["mainBtn" + (i - 1)]._width + btnSpacing);
trace(_loc4_._width);
_loc7_.numara.text = i + 1;
_loc7_._x = _loc7_._x + (menu_numbers["number" + (i - 1)]._x +
menu_numbers["number" + (i - 1)]._width + btnSpacing + 77);
if(_loc7_ == menu_numbers.number1)
{
menu_numbers.number1._x = menu_numbers.number1._x + -4;
}
if(_loc7_ == menu_numbers.number2)
{
menu_numbers.number2._x = menu_numbers.number2._x + 8;
}
if(_loc7_ == menu_numbers.number3)
{
menu_numbers.number3._x = menu_numbers.number3._x + 10;
}
if(_loc4_.subMenu)
{
_loc4_.subfolder = folder[i].childNodes;
_loc4_.createSubMenu = function()
{
if(switcher == false)
{
var _loc5_ = mainMenu.createEmptyMovieClip("subMenu",i);
slide(mainMenu.subMenu2,mainMenu.subMenu2._y,-
mainMenu.subMenu2._height -
50,slideOutSpeed,"_y",mx.transitions.easing.Strong.easeOut);
switcher = true;
}
else
{
_loc5_ = mainMenu.createEmptyMovieClip("subMenu2",i + 200);
slide(mainMenu.subMenu,mainMenu.subMenu._y,-
mainMenu.subMenu._height -
50,slideOutSpeed,"_y",mx.transitions.easing.Strong.easeOut);
switcher = false;
}
currSub = _loc5_;
var _loc2_ = undefined;
_loc2_ = 0;
while(_loc2_ < this.subMenu)
{
var _loc4_ = _loc5_.attachMovie("subBtn","subBtn" +
_loc2_,_loc2_ + 9000);
_loc4_.btnName.text = this.subfolder[_loc2_].attributes.NAME;
_loc4_.link = this.subfolder[_loc2_].attributes.LINK;
var _loc3_ = new Color(_loc4_.bg);
if(activeMain == mainMenu.mainBtn0)
{
_loc3_.setRGB(10867973);
}
else if(activeMain == mainMenu.mainBtn1)
{
_loc3_.setRGB(8699168);
}
else if(activeMain == mainMenu.mainBtn2)
{
_loc3_.setRGB(5678142);
}
else if(activeMain == mainMenu.mainBtn3)
{
_loc3_.setRGB(1273996);
}
_loc4_._x = activeMain._x;
_loc4_._y = _loc4_._height + vSpace * _loc2_;
_loc4_.onRelease = function()
{
getURL(this.link,"");
};
_loc4_.onRollOver = function()
{
var _loc2_ = new Color(this.bg);
_loc2_.setRGB(subActiveBg);
};
_loc4_.onRollOut = function()
{
var _loc2_ = new Color(this.bg);
if(activeMain == mainMenu.mainBtn0)
{
_loc2_.setRGB(10867973);
}
else if(activeMain == mainMenu.mainBtn1)
{
_loc2_.setRGB(8699168);
}
else if(activeMain == mainMenu.mainBtn2)
{
_loc2_.setRGB(5678142);
}
else if(activeMain == mainMenu.mainBtn3)
{
_loc2_.setRGB(1273996);
}
};
_loc2_ = _loc2_ + 1;
}
slide(_loc5_,-50,0,slideInSpeed,"_y",mx.transitions.easing.Strong.easeOut);
var _loc6_ = scope.attachMovie("mask","hitZone",1);
_loc6_._x = mainX + currButton._x - 50;
_loc6_._y = currButton._y - 5;
_loc6_._width = _loc5_._width + 100;
_loc6_._height = _loc5_._height + vSpace + mainY + 100;
_loc6_._alpha = 0;
_loc6_.useHandCursor = false;
_loc6_.onRollOver = function()
{
closeMenu();
callJS("0");
};
};
_loc4_.onRollOver = function()
{
if(activeMain != this)
{
activeMain = this;
activeStates(this.btnName);
if(_root.link != a)
{
LineBarColor = new Color(_root.LineBar);
if(activeMain == mainMenu.mainBtn0)
{
LineBarColor.setRGB(10802437);
}
else if(activeMain == mainMenu.mainBtn1)
{
LineBarColor.setRGB(8633375);
}
else if(activeMain == mainMenu.mainBtn2)
{
LineBarColor.setRGB(5612349);
}
else if(activeMain == mainMenu.mainBtn3)
{
LineBarColor.setRGB(1208203);
}
}
callJS("1");
currButton = this;
this.createSubMenu();
}
};
}
else
{
_loc4_.onRollOver = function()
{
if(activeMain != this)
{
activeMain = this;
activeStates(this.btnName);
closeMenu();
currButton = this;
if(_root.link != a)
{
LineBarColor = new Color(_root.LineBar);
if(activeMain == mainMenu.mainBtn0)
{
LineBarColor.setRGB(10802437);
}
else if(activeMain == mainMenu.mainBtn1)
{
LineBarColor.setRGB(8633375);
}
else if(activeMain == mainMenu.mainBtn2)
{
LineBarColor.setRGB(5612349);
}
else if(activeMain == mainMenu.mainBtn3)
{
LineBarColor.setRGB(1208203);
}
}
callJS("1");
}
};
_loc4_.onRollOut = function()
{
activeStates(null,null);
activeMain = null;
currButton = null;
};
_loc4_.onRelease = function()
{
if(activeMain != this)
{
if(_root.link != a)
{
_root.link = a;
}
getURL(this.link,"");
}
};
}
i++;
}
}
else
{
trace("XML yükleme hatasi");
}
}
function closeMenu()
{
slide(currSub,currSub._y,- currSub._height -
50,slideOutSpeed,"_y",mx.transitions.easing.Strong.easeOut);
activeStates(null,null);
activeMain = null;
currButton = null;
}
function callJS(c)
{
var _loc1_ = undefined;
_loc1_ = String(ExternalInterface.call("ShowHideMenu",c));
}
function activeStates(txt)
{
txt.textColor = mainActiveText;
currButton.btnName.textColor = mainText;
}
function slide(who, startvalue, endvalue, y_speed, prop, ease)
{
slider = new
mx.transitions.Tween(who,prop,ease,startvalue,endvalue,y_speed,true);
}
var btnSpacing = 55;
var vSpace = 34;
var slideSpeed = 1;
var mainX = 230;
var mainY = 43;
var mainBg = 15461098;
var mainText = 16777215;
var mainActiveText = 16777215;
var slideInSpeed = 0.9;
var slideOutSpeed = 1.2;
var subMenuX = 250;
var subBg = 1208460;
var subActiveBg = 5810655;
a = 2;
var scope = this;
scope.createEmptyMovieClip("mainMenu",2);
mainMenu._x = mainX;
mainMenu._y = mainY;
var mask = mainMenu.attachMovie("mask","mask",100);
mask._width = scope._width;
mask._height = scope._width;
mask._y = 10;
mainMenu.setMask(mask);
var switcher = true;
var menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = buildMenu;
menuXml.load(_root.MenuXmlPath);