PDA

View Full Version : Problem with easing scrollbar



flaxcreatures
March 5th, 2004, 05:48 PM
Hi there,
can someone help me with thisone: I've used the script from this board that was posted a week ago I presume.


fscommand("allowscale", "false");
_root.main.attachMovie("boxContect", "boxContect", 1)
bar.useHandCursor = false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._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)-main._y)/speed)*friction);
main._y += dy;
};
};



this was the script so if I try to load some thing dynamicly into the main MovieClip, it works but the scrollbar doesn't works properly, he doesn't noticed that the height from main has changed.

Can someone help me.
thx Kind regards
Flax

flaxcreatures
March 6th, 2004, 05:14 AM
nobody?

plz help

scotty
March 6th, 2004, 06:33 AM
Here it's working fine, I copied your code and used different "attachments".
Can you post your .fla?

scotty(-:

flaxcreatures
March 6th, 2004, 07:02 AM
ok
but there is a (dynamic) XML file where the data is read...

http://flaxcreatures.Acehosts.net/Allerlei/portfolioPrev.fla

scotty
March 6th, 2004, 07:19 AM
**Failed to open document** (MX2004??)

When I said it worked for me, I just took another mc from the library and changed the linkagename in the code.
Meanwhile I realized maybe you want it dynamically. The problem is then that you have to reset var "bottom". With a button the following worked:)
but.onRelease = function() {//but instancename button
attach("box2");//box2 is the linkage name
};
function attach(targ) {
main.attachMovie(targ, targ, 1);//attach movie
main._y = top;//going back to top
dragger._y = y;//dragger dito
bottom = main._y+mask_mc._height-main._height-space;//new bottom value
}

Hope this helps

scotty(-:

flaxcreatures
March 6th, 2004, 08:42 AM
yes I knew it was something like that ;)
I already tried with onEnterMovie(){
bottom = ...}

but it didn't worked properly

Kind regards and thx for the help

flaxcreatures
March 6th, 2004, 08:55 AM
I don't understand quite right: I don't use a button to attach the mc's but another MC:

btw, have a look at the FLA

here's the action at the middle of the MC:



stop();
function playBegin() {
clearInterval(hold);
play();
}
hold = setInterval(playBegin, 1000);
display.text = "Loading section " + _root.section

function attach(targ) {
_parent.panData.main.attachMovie(targ, targ + i, i);//attach movie
_parent.panData.main._y = top;//going back to top
_parent.panData.dragger._y = y;//dragger dito
_parent.panData.bottom = main._y+mask_mc._height-main._height-space;//new bottom value
}

var knopArrayNaam:Array = new Array();
root = _parent.portfolioDataXml.firstChild
if(root.hasChildNodes()){
for( var i = 0; i < root.childNodes.length; i++){

attach("news_btn");

newItem = _parent.panData.main.attachMovie("news_btn", "news_btn" + i, i)
newItem._x = 2
newItem._y = i*36+2
newItem.naam.text = root.childNodes[i].attributes.naam;
desc = root.childNodes[i].attributes.url;

/// knopActies
newItem.onRollOver = function(){
this.gotoAndPlay(2);}
newItem.onRollOut = function(){
this.gotoAndPlay(1);}
}
}

but.onRelease = function() {//but instancename button
//box2 is the linkage name
};

claudio
March 6th, 2004, 12:38 PM
The only parameter you need to redefine is bottom.

flaxcreatures
March 6th, 2004, 01:22 PM
good to know but how do I do that with the script that I gave you?
Cause I did what scotty told me but now it doesn't scrolls anymore: weired

I also have a little other probl: once I pressed the scrollbar, it just moves a tiny little bit to the left :s strange

regards

claudio
March 6th, 2004, 01:24 PM
I dont understand your code.
you got a function attach, where you are redefining the bottom parameter, but you never call that function?

flaxcreatures
March 6th, 2004, 01:49 PM
I do call it it's in the for action

"attach("news_btn")"

and if I do this:
_parent.panData.bottom = main._y+mask_mc._height-main._height-space;
nothing happens at all

claudio
March 6th, 2004, 01:59 PM
Can i see your fla?

flaxcreatures
March 6th, 2004, 02:03 PM
off coarse :sen:


check here: http://flaxcreatures.acehosts.net/Allerlei/portfolioPrev.fla

ok

claudio
March 6th, 2004, 02:11 PM
Is that mx2004? Cause im on mx.

scotty
March 6th, 2004, 02:13 PM
I'm not so in XML, but in your code you attach two time sa movie, once with the function "attach" and once just below where you call the function.
I'll post my fla as well, then you see it works (w/o xml) :)

scotty(-:

flaxcreatures
March 6th, 2004, 02:23 PM
ok good :d
I'm sure the XML is loaded right ;)

not that I can do XML very well (not at all actually :p)

cu guys

flaxcreatures
March 6th, 2004, 04:29 PM
oh man why do I always make stupid mistakes ?
Can someone tell me? :p

I used:


_parent.panData.bottom = main._y+mask_mc._height-main._height.space;



in stead of:



_parent.panData.bottom = _parent.panData.main._y+_parent.panData.mask_mc._h eight-_parent.panData.main._height-_parent.panData.space;

flaxcreatures
March 7th, 2004, 08:28 AM
Could someone give me advice on the next problem?

Now I finally succeded to load the content dyn which makes me extremely happy :p lol but what should I add to the actions if I reload another dyn. content after I moved the scrollbar. I guess he thinks that the MC is larger that normal :s

regards and I hope someone knows the answer ;) (off coarse)