import flash.display.BitmapData;
var ct = this.createEmptyMovieClip("ct", 1); // Container für das Panorama
ct._visible = false;
var img = ct.createEmptyMovieClip("img", 1); // Container für das zu ladende Bild
var images = new Array(); // Array für die Panorama-Bestandteile
var mcl = new MovieClipLoader();
mcl.onLoadInit = function() {
buildPano();
}
var xm = new XML();
xm.ignoreWhite = true;
xm.onLoad = function() {
parse(this.firstChild);
}
xm.load("img.xml"); // XML-Datei laden
function parse(obj) {
speed = 10;
loadImage(obj.firstChild.attributes.pic);
}
function loadImage(src) {
mcl.loadClip(src, img);
}
function buildPano() {
var bmp = new BitmapData(img._width, img._height);
bmp.draw(img);
img.removeMovieClip();
images[0] = ct.createEmptyMovieClip("img1", 1);
images[1] = ct.createEmptyMovieClip("img1", 2);
for (var i in images) {
images[i].attachBitmap(bmp, 1, true, false);
}
images[1]._x = images[0]._width;
ct._visible = true;
go();
}
function go() {
this.onEnterFrame = function() {
var mitte=490;
var maxspeed=20;
speed=Math.round((this._xmouse-mitte)/20);
if(speed>maxspeed)
speed=maxspeed;
if(speed<maxspeed*(-1))
speed=maxspeed*(-1);
for (var i=0; i<images.length; i++) {
images[i]._x -= Math.round(speed);
}
for (var i=0; i<images.length; i++) {
if (speed > 0 && images[i]._x < -images[i]._width) putRight(i);
if (speed < 0 && images[i]._x > Stage.width) putLeft(i);
}
}
}
function putRight(n) {
var obj = images[n];
var prev = (n > 0)? images[n - 1] : images[images.length - 1];
obj._x = prev._x + prev._width;
}
function putLeft(n) {
var obj = images[n];
var prev = (n < images.length - 1)? images[n + 1] : images[0];
obj._x = prev._x - obj._width;
}
linie.swapDepths(10);