Questo il codice riferito allo scroll del file importato...
function scrollUpdate() {
var my_mc = this._parent.my_mc;
if (my_mc._height<this.bg._height) {
this._visible = false;
} else {
this._visible = true;
}
var pxls_cont = my_mc._height-this.bg._height;
var pxls_scroll = this.bg._height-this.barra._height;
var alfa = pxls_cont/pxls_scroll;
var vel = 2;
var desty = -this.barra._y*alfa+this.hxini;
desty = Math.floor(desty);
my_mc._y = Math.floor((my_mc._y*vel+desty)/(vel+1));
}
function startScrool() {
yfin = this._parent.bg._height-this._height;
this.startDrag("", this._x, 0, this._x, yfin);
}
function stopScroll() {
this.stopDrag();
}
function moveScroll(dir) {
if (dir == "stop") {
delete controlla["onEnterFrame"];
} else {
var barra = this.barra;
var vel = 4;
if (dir == "top") {
var lim = 0;
vel = vel*-1;
} else {
var lim = this.bg._height-barra._height;
}
}
controlla.onEnterFrame = function() {
if (dir == "foot") {
if (barra._y+vel<lim) {
barra._y = barra._y+vel;
} else {
barra._y = lim;
}
} else if (barra._y+vel>lim) {
barra._y = barra._y+vel;
} else {
barra._y = lim;
}
};
}
this.hxini = this._parent.my_mc._y;
this.onEnterFrame = scrollUpdate;
this.barra.onPress = startScrool;
this.barra.onRelease = stopScroll;
this.barra.onReleaseOutside = stopScroll;
this.createEmptyMovieClip("controlla", 100);
sup.onPress = function() {
moveScroll("top");
};
sup.onRelease = inf.onRelease=function () {
moveScroll("stop");
};
inf.onPress = function() {
moveScroll("foot");
};
inf.onRelease = function() {
moveScroll("stop");
};
barra.useHandCursor = false;
barra._alpha = 50;
sup.useHandCursor = false;
inf.useHandCursor = false;
barra.onRollOver = function() {
barra.alphaTo(100, 2);
};
barra.onRollOut = function() {
barra.alphaTo(50, 2);
};
sup = barra._y+10;
mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
if (meuScroll._visible) {
return;
}
if (barra._y<=sup && delta>0 || barra._y>=yfin && delta<0) {
return;
} else {
barra._y -= delta*6;
drag();
}
};
Mouse.addListener(mouseListener);

Rispondi quotando