大家好,我需要一些关于如何在 as3 中编码以在鼠标悬停在按钮上显示图像的帮助。实际上我现在有这个。我需要按钮在鼠标悬停时在屏幕上显示一些图像。. . . . . . . .
var centerX:Number = 330;
var centerY:Number = 130;
var radiusX:Number = 250;
var radiusY:Number = 50;
var speed:Number = 0.1;
var farthestFade:Number = 0.2;
var farthestSize:Number = 1;
var minSpeed:Number = -0.10;
var maxSpeed:Number = 0.10;
var rangeSpeed:Number = maxSpeed - minSpeed;
var minY:Number = centerY - radiusY;
var maxY:Number = centerY + radiusY;
var rangeY:Number = maxY - minY;
var minScale:Number = 0.3;
var maxScale:Number = 0.7;
var rangeScale:Number = maxScale - minScale;
var itemArray:Array = new Array();
var image1MC:image1 = new image1();
itemArray.push(image1MC);
image1MC.targetURL = "http://www.gmail.com";
var image2MC:image2 = new image2();
itemArray.push(image2MC);
image2MC.targetURL = "http://www.gmail.com";
var image3MC:image3 = new image3();
itemArray.push(image3MC);
image3MC.targetURL = "http://www.twitter.com";
var image4MC:image4 = new image4();
itemArray.push(image4MC);
image4MC.targetURL = "http://www.facebook.com";
var image5MC:image5 = new image5();
itemArray.push(image5MC);
image5MC.targetURL = "http://www.linkedin.com";
var image6MC:image6 = new image6();
itemArray.push(image6MC);
image6MC.targetURL = "http://www.microsoft.com";
var image7MC:image7 = new image7();
itemArray.push(image7MC);
image7MC.targetURL = "http://www.irctc.co.in";
var image8MC:image8 = new image8();
itemArray.push(image8MC);
image8MC.targetURL = "http://www.yahoo.com";
var canvas:MovieClip = new MovieClip();
addChild(canvas);
for (var i:Number = 0; i < itemArray.length; i++)
{
canvas.addChild(itemArray[i]);
itemArray[i].buttonMode = true;
itemArray[i].addEventListener(MouseEvent.CLICK, goToURL);
itemArray[i].itemAngle = Math.PI * 2 / itemArray.length * i;
itemArray[i].addEventListener(Event.ENTER_FRAME, animate);
}
function goToURL(e:MouseEvent):void
{
var req:URLRequest = new URLRequest(e.currentTarget.targetURL);
navigateToURL(req);
}
function animate(e:Event):void
{
speed = mouseX / stage.stageWidth * rangeSpeed + minSpeed;
e.currentTarget.x = Math.cos(e.currentTarget.itemAngle) * radiusX + centerX;
e.currentTarget.y = Math.sin(e.currentTarget.itemAngle) * radiusY + centerY;
e.currentTarget.itemAngle += speed;
itemArray.sortOn("y");
for(var i:Number = 0; i < itemArray.length; i++)
{
canvas.setChildIndex(itemArray[i], i);
var pct:Number = (itemArray[i].y - minY) / rangeY;
var scale:Number = pct * rangeScale + minScale;
itemArray[i].scaleX = itemArray[i].scaleY = scale;
}
}