View Full Version : my_sb.setScrollTarget(text1 && text2) - how?
inhan
01-06-2007, 12:28 AM
Is there a way to scroll 2 text fields having the same height and parallel to each other? I'm taking values (from an xml) into 2 text fields, each value next to the corresponding value (something like a char, I might say) and tabs are so restrictive so I ended up with this solution. Anyway I can't make the scrollBar component to control 2 fields with actions like:
my_sb.setScrollTarget(text1 && text2);
my_sb.setScrollTarget(text1, text2);
Any opinions?
inhan
01-06-2007, 12:31 AM
Result I want to achieve is something like:
1998-2002 something
2002-2003 something quite long to make this line become multiple
blah blah blah blah blah blah sui generis thing blah blah
blah blah blah blah blah another sui generis thing blah blah
2003-2005 something else
inhan
01-06-2007, 12:33 AM
Problem occurs (when I use tabs) especially when I got a longer value that wraps like the second one above. Those 3 lines are actually one value by the way.
inhan
01-06-2007, 03:11 AM
Any way I can make the first text listen to the 2nd?
inhan
01-06-2007, 06:04 AM
Now I'm using tabs in the xml itself - although I hate to put brakes (<br>) into the long values, but I'd be glad if anybody had any alternative solution to this.
CyanBlue
01-06-2007, 03:11 PM
Hm... Can't you do something like this and attach it to ScrollPane or something??? That sounds whole lot simpler to me... Just a thought...
var data_arr:Array = new Array();
data_arr.push({data1:"1998-2002", data2:"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vitae augue. Curabitur dapibus eros. Nulla convallis gravida massa. Sed facilisis nulla ac dolor. Nunc orci. Sed at arcu. Suspendisse ut dolor. Fusce quam. Vestibulum accumsan nunc nec elit. Donec a nulla id magna rutrum sollicitudin. "});
data_arr.push({data1:"2002-2003", data2:"In ullamcorper scelerisque purus. Vivamus enim odio, facilisis non, malesuada at, dictum sit amet, leo. Vivamus sed leo. Nulla leo. Sed nibh lorem, ultrices eget, eleifend quis, porta sed, diam. Curabitur dui risus, vulputate hendrerit, dignissim id, malesuada vitae, ante. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque lorem. Nulla pharetra. Etiam dolor. \n\nSed ornare accumsan metus. Suspendisse pretium dui at augue. Nunc et dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus."});
data_arr.push({data1:"2003-2005", data2:"Phasellus vestibulum erat ac mauris. Quisque consequat mauris sit amet lectus suscipit viverra. Nunc porta eros a urna. Morbi nec tortor eu mi pretium tempor. Integer suscipit blandit ante. Nam quis erat in lorem pharetra nonummy. Etiam imperdiet. Etiam eu magna ut enim tincidunt auctor. Sed eget diam vel purus auctor dapibus. Aliquam erat volutpat. Donec lacinia consectetuer nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec congue nonummy nulla. Vivamus vitae mi vel risus sagittis egestas. Mauris viverra dui a mauris euismod scelerisque. Proin eleifend. Morbi euismod placerat purus."});
createText(data_arr);
function createText(_arr:Array)
{
this.createEmptyMovieClip("content_mc", this.getNextHighestDepth());
for (var i = 0 ; i < _arr.length ; i++)
{
trace(_arr[i].data1 + "\t\t" + _arr[i].data2);
var _data1:TextField = this.content_mc.createTextField("r" + i + "data1_txt", this.content_mc.getNextHighestDepth(), 0, 0 + this.content_mc["r" + (i - 1) + "data2_txt"]._y + this.content_mc["r" + (i - 1) + "data2_txt"]._height + 10, 75, 20);
_data1.border = true;
_data1.text = _arr[i].data1;
var _data2:TextField = this.content_mc.createTextField("r" + i + "data2_txt", this.content_mc.getNextHighestDepth(), 85, 0 + this.content_mc["r" + (i - 1) + "data2_txt"]._y + this.content_mc["r" + (i - 1) + "data2_txt"]._height + 10, 400, 20);
_data2.autoSize = true;
_data2.border = true;
_data2.multiline = true;
_data2.wordWrap = true;
_data2.text = _arr[i].data2;
}
}
Arg... AS tag sucks in this case... :(
inhan
01-07-2007, 04:31 AM
Thank you a lot CyanBlue, it seems I've stolen quite a time from you :)
My problem, well the real problem is that I'm loading the information from an XML document. I have 7 links all of which work just the way I want except the longer one I'm willing to attach the scroll bar. Most probably because of the component, the data gets loaded with an app. 2 sec delay. I know if I make a scroll bar myself, I can move multiple objects but (1) I couldn't find and peoper script that scrolls smoothly + that moves also when you click on somewhere arounnd the rectangle the slider moves (like the component) + that works not with enterFrame which causes blinking of the cursor (2) I'm afraid my 150 lines script will get slower with some dozens more.
What do you think?
CyanBlue
01-08-2007, 01:42 PM
I have no idea how to achieve that, but I'd love to see your implementation when you get it working... ;)
inhan
01-08-2007, 01:51 PM
Well I made a scroll bar myself and it does work exactly the way I want except the "bar dragging" feature. But this time (I haven't attached or even copied the bar into this file yet) for some reason I have a 1-1.5 sec. delay in the loading phase. I'll try to load that text especially -I have 6 more- in the beginning and change _visible to false. Hope that works the way I want..
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.