FORUMS: list search recent posts

AS2 Conflicting Scripts

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
matt short
AS2 Conflicting Scripts
on Nov 14, 2009 at 5:54:39 pm

I've built 2 scrollbars w/text side by side and I have 2 AS on different layers to control each. The problem is both scrollbars control the text window of the AS which is on the bottom (layer in the timeline).

Here's the top AS...

fscommand("allowscale", "false");
bar2.useHandCursor = dragger2.useHandCursor=false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger2._y;
top = newsTXT._y;
bottom = newsTXT._y+mask_mc2._height-newsTXT._height-space;
dragger2.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar2._height-this._height);
dragger2.scrollEase();
};
dragger2.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar2.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger2._height) {
this._parent.dragger2._y = this._parent._ymouse;
this._parent.dragger2._y = this._y+this._height-this._parent.dragger2._height;
} else {
this._parent.dragger2._y = this._parent._ymouse;
}
dragger2.scrollEase();
};
bar2.onMouseUp = function() {
drag = false;
};
moveDragger2 = function (d) {
if ((dragger2._y>=y+bar2._height-dragger2._height && d == 1) || (dragger2._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger2._y += d;
dragger2.scrollEase();
updateAfterEvent();
}
};
up_btn2.onPress = function() {
myInterval = setInterval(moveDragger2, 18, -1);
};
down_btn2.onPress = function() {
myInterval = setInterval(moveDragger2, 18, 1);
};
up_btn2.onMouseUp = down_btn2.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar2._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-newsTXT._y)/speed)*friction);
newsTXT._y += dy;
};
};

And here's the bottom AS...

fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger._y;
top = eventsTXT._y;
bottom = eventsTXT._y+mask_mc._height-eventsTXT._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-eventsTXT._y)/speed)*friction);
eventsTXT._y += dy;
};
};


Return to posts index

matt short
Re: AS2 Conflicting Scripts
on Nov 14, 2009 at 10:31:00 pm

Problem Solved



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]