Hey people,
I’m making a site that loads in a small .swf text scroller. This scroller works fine on it’s own(http://utharr.50megs.com/builder/textscroller.swf ). However, when I load it into my main.swf (via loadMovie), the handle bar or grip for scrolling the content just doesn’t work properly. You can still always see it, but sometimes it doesn’t act as a button you can pull and push on. ([URL=http://utharr.50megs.com/builder/builder.swf]http://utharr.50megs.com/builder/builder.swf ) <-- At this address, click on download, and in the submenu version history. Sorry at this point I haven’t added a preloader for either .swf (the text scroller is about 7k, and the main is about 80K, so I hope you don’t mind waiting a little)
Here’s the code in the textscroller.swf
//set a variable & initialize to zero
targY=0;
//set the x position of the dragger equal to the mask + 17
dragger._x=theMask._width+17;
//set the drag action of the dragger
//drag is restricted to the height of the mask
dragger.onPress=function(){
startDrag(this,true,this._x,0,this._x,theMask._height-this._height);
}
//stop the drag
dragger.onRelease=dragger.onReleaseOutside=function(){
stopDrag();
}
//set the mask for the text
theText.setMask(theMask);
//the scrolling animation
theText.onEnterFrame=function(){
/*set a variable
this variable basically stores info regarding what fraction of the total text
is being displayed through the mask and ensures that dragging the dragger
from top to bottom will reveal all the text.
this allows you to change the amount of text and the scroller will update itself
*/
scrollAmount=(this._height-(theMask._height/1.3))/(theMask._height-dragger._height);
//set a new target y position
targY=-dragger._y*scrollAmount;
//set the y of the text to 1/5 of the distance between its current y and the target y
//change the 5 to a lower number for faster scrolling or a higher number for slower scrolling
this._y-=(this._y-targY)/5;
}
I was hoping anybody (lost/ilys?) could point out what I’m doing wrong, because I’ve been working at it for a while now, and I’m kinda stuck.
Thanks for your time,
Uth