Hallo zusammen,
ich habe von einem bekannten einen Code für eine Panorama-Animation bekommen.
PHP-Code:
addEventListener(Event.ENTER_FRAME, scrollit);
// -> is the zone defined for scrolling
var offset:int = 10;
// stage.StageWidth - panowidth
function scrollit (e)
{
if (mouseX < offset)
{
trace("goleft");
pano_mc.x = pano_mc.x-4;
pano2_mc.x = pano2_mc.x-4;
if (pano_mc.x<=stage.stageWidth-pano_mc.width&&pano_mc.x>=stage.stageWidth-pano_mc.width-5)
{
pano2_mc.x = pano_mc.x+pano_mc.width;
};
if (pano2_mc.x<=stage.stageWidth-pano2_mc.width&&pano2_mc.x>=stage.stageWidth-pano2_mc.width-5)
{
pano_mc.x = pano2_mc.x+pano2_mc.width;
};
}
if (mouseX > stage.stageWidth - offset && mouseX < stage.stageWidth )
{
trace("goright");
pano_mc.x = pano_mc.x+4;
pano2_mc.x = pano2_mc.x+4;
if (pano_mc.x>0&&pano_mc.x<5)
{
pano2_mc.x = pano_mc.x-pano_mc.width;
};
if (pano2_mc.x>0&&pano2_mc.x<5)
{
pano_mc.x = pano2_mc.x-pano_mc.width;
};
}
}
Es funktioniert alles blendend, bis ich weitere Objekte (mc's) auf das Panorama setze. Dann verschwinden diese plötzlich beim Scroll.
Ich bin ein totaler Actionscript-Anfänger. Deshalb bitte ich um Nachsicht, wenn mein eigener Code null Sinn macht.
PHP-Code:
addEventListener(Event.ENTER_FRAME, scrollit);
// -> is the zone defined for scrolling
var offset:int = 10;
// stage.StageWidth - panowidth
function scrollit (e)
{
if (mouseX < offset)
{
//trace("goleft");
pano_mc.x = pano_mc.x-4;
pano2_mc.x = pano2_mc.x-4;
stern_mc.x = stern_mc.x-4;
stern2_mc.x = stern2_mc.x-6;
stern3_mc.x = stern3_mc.x-5;
maria_mc.x = maria_mc.x-4;
if (pano_mc.x<=stage.stageWidth-pano_mc.width&&pano_mc.x>=stage.stageWidth-pano_mc.width-5)
{
pano2_mc.x = pano_mc.x+pano_mc.width;
};
if (pano2_mc.x<=stage.stageWidth-pano2_mc.width&&pano2_mc.x>=stage.stageWidth-pano2_mc.width-5)
{
pano_mc.x = pano2_mc.x+pano2_mc.width;
};
}
if (mouseX > stage.stageWidth - offset && mouseX < stage.stageWidth )
{
//trace("goright");
pano_mc.x = pano_mc.x+4;
pano2_mc.x = pano2_mc.x+4;
stern_mc.x = stern_mc.x+4;
stern2_mc.x = stern2_mc.x+6;
stern3_mc.x = stern3_mc.x+5;
maria_mc.x = maria_mc.x+4;
if (pano_mc.x>0&&pano_mc.x<5)
{
pano2_mc.x = pano_mc.x-pano_mc.width;
};
if (pano2_mc.x>0&&pano2_mc.x<5)
{
pano_mc.x = pano2_mc.x-pano2_mc.width;
};
if (stern_mc.x>0&&stern_mc.x<10)
{
pano_mc.x = pano2_mc.x-pano2_mc.width;
};
}
}
Ich wäre sehr dankbar für etwas Hilfe. Wie kann ich meine eigenen Objekte, (welche kleiner sind als die Panorama MC's) in den Code integrieren?
Vielen Dank schon mal.