Actionscript 2.0
Hej jeg håber der er nogle hajer derude til as2 :)Jeg er ved at lave et galleri, som er en karussel.
Istedet for farver, skal der være en række unikke billeder, men ved ikke hvordan koden så skal se ud, pt. ser den sådan ud:
var numOfItems:Number = 10;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;
var speed:Number = 0.05;
var links:Array = ['http://hej.dk, 'http://hej.dk', 'http://hej.dk];
var colors:Array = [0x4ba3fe, 0xffff00, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000];
for(var i=0; i<numOfItems; i++)
{
var t = this.attachMovie("item", "item"+i, i+1);
var c:Color;
t.Angle = i * ((Math.PI*2)/numOfItems);
c = new Color(t.icon);
c.setRGB(colors[i]);
t.url = links[i];
t.onEnterFrame = mover;
}
function mover()
{
this._x = Math.cos(this.Angle) * radiusX + centerX;
this._y = Math.sin(this.Angle) * radiusY + centerY;
var s:Number = this._y/ (centerY+radiusY);
this._xscale = this._yscale = s *100;
this.Angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
this.onRelease = released;
}
released = function()
{
trace("im hit!! " + this.url);
this.getURL(this.url,"_self");
}
this.onMouseMove = function()
{
speed = (this._xmouse - centerX)/2000;
}