Flash中的AS
varmyXML=newXML();myXML.ignoreWhite=true;myXML.load("Photos.xml");myXML.onLoad=functi...
var myXML = new XML();
myXML.ignoreWhite = true;
myXML.load("Photos.xml");
myXML.onLoad = function(success) {//装载xml文件
if (success) {
var myList = myXML.firstChild.childNodes;
var PhotoNum=myList.length-1;
var vx=30,vy=20,va=.9,vs=.96,tx
var vxs=50,vys=100,vas=100,vss=100
for(i=0;i<=PhotoNum;i++)
{
_root.attachMovie("MC_photo","MC_photo"+i, 100-i);
setProperty("MC_photo"+i,_x,vxs);
setProperty("MC_photo"+i,_y,vys);
//setProperty("MC_photo"+i,_alpha,vas);
setProperty("MC_photo"+i,_xscale,vss);
setProperty("MC_photo"+i,_yscale,vss);
_root["MC_photo"+i].LoadName=myXML.childNodes[0].childNodes[i].attributes.imgURL;
_root["MC_photo"+i].gotoAndStop(2);
_root["MC_photo"+i].tx=_root["MC_photo"+i]._x;
_root["MC_photo"+i].ty=_root["MC_photo"+i]._y;
_root["MC_photo"+i].ts=_root["MC_photo"+i]._xscale;
_root["MC_photo"+i].td=100-i;
_root["MC_photo"+i].onRollOver=function()
{
this.onEnterFrame=function()
{
d=this.tx+100*(this._xscale/100)-this._x;
if(d<=0.1){delete this.onEnterFrame}
this._x+=d/4;
}
}
_root["MC_photo"+i].onRollOut=function()
{
this.onEnterFrame=function()
{
d=this.tx-this._x;
if(Math.abs(d)<=0.1){delete this.onEnterFrame}
this._x+=d/3;
}
}
_root["MC_photo"+i].onPress=function()
{
this.enabled=false;
this.swapDepths(101)
this.onEnterFrame=function()
{
dx=170-this._x;
dy=220-this._y
if(Math.abs(dx)<=0.1 and Math.abs(dy)<=0.1)
{
if(Math.abs(200-this._xscale)<1)
{
delete this.onEnterFrame;
this._xscale=200;
this._yscale=200;
this.onMouseDown=function()
{
delete this.onMouseDown;
this.onEnterFrame=function()
{
if(Math.abs(this._x-this.tx)<.1 and Math.abs(this._y-this.ty)<.1)
{
delete this.onEnterFrame;
this.swapDepths(this.td);
this.enabled=true;
}
this._x+=(this.tx-this._x)/2
this._y+=(this.ty-this._y)/2
this._xscale+=(this.ts-this._xscale)/2;
this._yscale+=(this.ts-this._yscale)/2;
}
}
}
this._xscale+=(200-this._xscale)/2;
this._yscale+=(200-this._yscale)/2;
}
this._x+=dx/2
this._y+=dy/2
}
}
vx*=1;
vy*=0.65;
vxs+=vx;
vys-=vy;
vas*=va;
vss*=vs;
}
}
else
{
trace("Error!!!");
}
}
以上语句大概是什么意思? 展开
myXML.ignoreWhite = true;
myXML.load("Photos.xml");
myXML.onLoad = function(success) {//装载xml文件
if (success) {
var myList = myXML.firstChild.childNodes;
var PhotoNum=myList.length-1;
var vx=30,vy=20,va=.9,vs=.96,tx
var vxs=50,vys=100,vas=100,vss=100
for(i=0;i<=PhotoNum;i++)
{
_root.attachMovie("MC_photo","MC_photo"+i, 100-i);
setProperty("MC_photo"+i,_x,vxs);
setProperty("MC_photo"+i,_y,vys);
//setProperty("MC_photo"+i,_alpha,vas);
setProperty("MC_photo"+i,_xscale,vss);
setProperty("MC_photo"+i,_yscale,vss);
_root["MC_photo"+i].LoadName=myXML.childNodes[0].childNodes[i].attributes.imgURL;
_root["MC_photo"+i].gotoAndStop(2);
_root["MC_photo"+i].tx=_root["MC_photo"+i]._x;
_root["MC_photo"+i].ty=_root["MC_photo"+i]._y;
_root["MC_photo"+i].ts=_root["MC_photo"+i]._xscale;
_root["MC_photo"+i].td=100-i;
_root["MC_photo"+i].onRollOver=function()
{
this.onEnterFrame=function()
{
d=this.tx+100*(this._xscale/100)-this._x;
if(d<=0.1){delete this.onEnterFrame}
this._x+=d/4;
}
}
_root["MC_photo"+i].onRollOut=function()
{
this.onEnterFrame=function()
{
d=this.tx-this._x;
if(Math.abs(d)<=0.1){delete this.onEnterFrame}
this._x+=d/3;
}
}
_root["MC_photo"+i].onPress=function()
{
this.enabled=false;
this.swapDepths(101)
this.onEnterFrame=function()
{
dx=170-this._x;
dy=220-this._y
if(Math.abs(dx)<=0.1 and Math.abs(dy)<=0.1)
{
if(Math.abs(200-this._xscale)<1)
{
delete this.onEnterFrame;
this._xscale=200;
this._yscale=200;
this.onMouseDown=function()
{
delete this.onMouseDown;
this.onEnterFrame=function()
{
if(Math.abs(this._x-this.tx)<.1 and Math.abs(this._y-this.ty)<.1)
{
delete this.onEnterFrame;
this.swapDepths(this.td);
this.enabled=true;
}
this._x+=(this.tx-this._x)/2
this._y+=(this.ty-this._y)/2
this._xscale+=(this.ts-this._xscale)/2;
this._yscale+=(this.ts-this._yscale)/2;
}
}
}
this._xscale+=(200-this._xscale)/2;
this._yscale+=(200-this._yscale)/2;
}
this._x+=dx/2
this._y+=dy/2
}
}
vx*=1;
vy*=0.65;
vxs+=vx;
vys-=vy;
vas*=va;
vss*=vs;
}
}
else
{
trace("Error!!!");
}
}
以上语句大概是什么意思? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询