Scroller Not Adjusting to Dynamic Text
I have a dynamic text box that adjust in height according to how much text is inserted by xml. The problem is that my scroll bar is not recognizing that the text box has grown in length, therefore it doesn't scroll all the way.
I need to find a way to get the scroll to recognize that the text box has grown.
Help, please! Thanks!
Attached Files
the friendly canadian
*doesn't know the real answer*
Couldn't you just have an:
Code:
clip.onEnterFrame = function(){
this._height = this.textbox._height+10
}
Wouldn't the textbox grow with the imported text, causing the MC to grow and thus be scrollable?
Hmmmmm.... good theory. Let me try it out real quick. I think that might be the problem, because the scroll is measuring the size of an MC, not a text box.
I'll be back.........
Errr... actually I have it set up that way already.
I have the scroller checking the height of "main", which is the instance name of the text box.
Any other options?
the friendly canadian
I have something like this set up on one of my files. I'll reply when I get home (on my portable HD in another city :@).
Thanks DaVulf.... I appreciate it.
the friendly canadian
Okay, this is the code on the first frame of my 'Newsbox' mc.
PHP Code:
oadVarsText = new LoadVars ();
loadVarsText . load ( "news.txt" );
loadVarsText . onLoad = function( success ) {
if ( success ) {
trace ( "done loading" );
//trace(this.myText);
main . mainText . htmlText = this . myText ;
main . mainText . autoSize = "left" ;
trace ( "TEXTFIELD HEIGHT: " + main . mainText . _height );
trace ( "CLIP HEIGHT: " + main . _height );
offset = main . _height - main . mainText . _height ;
trace ( "OFFSET: " + offset );
bottom = ( main . _y + mask_mc . _height - main . _height - space )+ offset ;
} else {
trace ( "not loaded" );
}
};
stop ();
fscommand ( "allowscale" , "false" );
//bar.useHandCursor = dragger.useHandCursor=false;
space = - 150 ;
friction = .6 ; //was 0.9
speed = 4 ; //was 4
y = dragger . _y ;
top = main . _y ;
bottom = ( main . _y + mask_mc . _height - main . _height - space );
dragger . onPress = function() {
//trace(this._parent);
drag = true ;
this . startDrag ( false , this . _x , this . _parent . y , this . _x , this . _parent . y + this . _parent . bar . _height - this . _height );
scrollEase1 ();
};
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 ;
}
scrollEase1 ();
};
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 ;
scrollEase1 ();
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 . scrollEase1 = function() {
//trace("YO!");
dragger . 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 ;
};
};
I have attached the .fla with the symbol in it.
edit: Props to oldnewbie for helping me with this a few months ago.
Attached Files
DaVulf.... I can't open your .fla because I'm using MX. Can you save it in actionscript 1.0?
Thanks!
I've tried pasting the code above in my movie, but it's not working for me. I noticed that you had a line that wanted to load an external text file, but I'm using an XML file that's running off nodes..... which is a completly different script.
I'm a little confused with the code you provided. You clarify on how I'm suppose to use it?
Here's the .fla with the updated code that's not working.
Attached Files
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width