PDA

View Full Version : Tweenlite TextField scrolling without scroll bars



numediaweb
January 13th, 2009, 07:18 AM
Hello Kirupians!
[Summary]
i was playing around a dynamic AS3 Textfield scolling script, i would like to add 2 buttons, 1 in top of textfield and one down, to use them as mouse-over scrollers (instead of the old fashioned click-to-scroll scrollbar -I hate clickable scrollbars :lol: - ).. then spice everything with som greenish Tweenlite socks!
now, inside my fla ther's the dynamic textfield set to a fixed width/height, it recieves dynamic text (may be too long or short)
i have so far developped this:

// set text to textfield
avaTXT.TEXT_AVATAR.text="get it from xml files";
// set end of scroll
var scrolMax:Number=avaTXT.TEXT_AVATAR.maxScrollV;
// listen to buttons
btn_skroll_up.addEventListener(MouseEvent.ROLL_OVE R,avaUp);
btn_skroll_down.addEventListener(MouseEvent.ROLL_O VER,avaDown);
// go for hunting
function avaUp(e:Event):void {
TweenLite.to(avaTXT.TEXT_AVATAR,1,{y:0,overwrite:0 });
}
function avaDown(e:Event):void {
if (scrolMax<0) {
TweenLite.to(avaTXT.TEXT_AVATAR,1,{y:scrolMax,over write:0});
}
}
// what should i use; scrollV, maxScrollV, bottomScrollV !?


[SYMPTOMS]
I tried the tweenmax example (http://www.byrographics.com/AS3/textScroller/scrollingText.html) but i found that the mouseWheel doesn't work and i don't want to use scrollers and i got to use Tweenlite (too much conditions eh! :D ).

[MORE INFORMATION]
I searched in tweenlite forum and asked ther but until now, ther's no solution.

thanx for any tips!

numediaweb
January 13th, 2009, 09:19 AM
[Fixed]
now it's better!

import classes.gs.TweenLite;
// play here \\

// scroll text avatar; avaTXT btn_skroll_down up
var myTextField:TextField = new TextField();
var avaTXTy = avaTXT.y;
avaTXT.addChild(myTextField);
var txt="LOREM IPSUM DOLOR..";
myTextField.text=txt;
myTextField.width=215;
myTextField.multiline=true;
myTextField.wordWrap=true;
myTextField.autoSize=TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
myFormat.size=12;
myTextField.setTextFormat(myFormat);
var scrolMax:Number=ava_mask.height-avaTXT.height;
btn_skroll_up.addEventListener(MouseEvent.ROLL_OVE R, avaUp);
btn_skroll_down.addEventListener(MouseEvent.ROLL_O VER, avaDown);
function avaUp(e:Event):void {
TweenLite.to(avaTXT, 1, {y:avaTXTy, overwrite:0});
}
function avaDown(e:Event):void {
//if (scrolMax<0) {
TweenLite.to(avaTXT, 1, {y:scrolMax+avaTXTy, overwrite:0});
//}
}
trace(avaTXT.y);

i got on stage:
* two buttons
* an mc named avaTXT masked by ava_mask

just in case someone is stuck with similar issue as mine.