Hi Folks,
ich versuche mich gerade an einer kleinen Variation des klassischen 3d Rotations-Menu.
Das Grund-Skript habe ich mir aus einem Beispiel von flashstar.de geholt:
http://flashstar.de/fla/mx/fs3dmxmenuv3.swf
In meiner Variante soll das Ganze nun nicht per Mausposition gedreht werden, sondern per Buttons "durchgeschaltet" werden.
In meinen Versuchen klappt das bisher nur mit Abstrichen. Die Abfrage der Position ist einfach zu ungenau.
Der große Held in Trigonometrie bin ich auch nicht. Kann mir jemand helfen bzw. kennt jemand ein Tutorial/Link mit Hilfe? Wäre der Hit!
Muchas Gracias!!!
Hier der Beispiel-Code:
(Hab das Ganze zwar noch in Klassen, aber hier gehts ja ums Prinzip)
PHP-Code:
fscommand("allowscale", "false");
//var n:Number = Math.PI / 2;
// Menüeinträge
links = new Array();
links[1] = ["http://www.flashstar.de","Flashstar"];
links[2] = ["http://www.flashangel.de","Flashangel"];
links[3] = ["http://www.flashpower.de","Flashpower"];
links[4] = ["http://www.multimedia.de","Multimedia"];
// Bühnen Breite + Höhe
posX = Stage.width / 2;
posY = Stage.height / 2;
// Clips Erzeugen
anzahl = links.length - 1;
for (var i = 1; i < anzahl + 1; i++)
{
attachMovie("clip", "clip" + i, i);
}
//Base vars
dir = 0;
dummy_count = 0;
count = 0;
count_step = 0;
y_radius = 100;
x_radius = 200;
// Winkelgab für rotaton festlegen
step = ((360 / anzahl + (360 / anzahl)) * Math.PI) / 180;
function startRotation(dir:Number)
{
_root.onEnterFrame = function()
{
_root.rotate(_root.dir);
}
}
this.next.onRelease = function ()
{
_root.dir = 1;
startRotation(1);
}
this.prev.onRelease = function ()
{
_root.dir = -1;
startRotation(-1);
}
function stopRotation()
{
delete _root.onEnterFrame;
}
rotate = function(dir:Number)
{
var check = ((countStep + (360 / anzahl)) * Math.PI) / 180;
if(check > _root.step)
{
_root.count = 0;
_root.countStep = 0;
_root.stopRotation();
return;
}
dummy_count += 10 * dir;
countStep += 10;
for (var i = 1; i < anzahl + 1; i++)
{
winkel = ((dummy_count + (360 / anzahl * i)) * Math.PI) / 180;
//winkel = (((360 / anzahl * i)) * Math.PI) / 180;
this["clip" + i]._x = posX + (Math.sin(-winkel) * x_radius);
this["clip" + i]._y = posY + (Math.cos(-winkel) * y_radius);
this["clip" + i]._xscale = 100 + (Math.cos(winkel) * y_radius)
this["clip" + i]._yscale = 100 + (Math.cos(winkel) * y_radius);
this["clip" + i].swapDepths(1000 + (Math.cos(winkel) * y_radius));
this["clip" + i].txtName = links[i][1].toUpperCase();
}
}
// MX (Logo)
planet.swapDepths(999 + 1);