flash help
- Started
- Last post
- 15 Responses
- connerd
has anyone seen any examples of text-overflow done in flash?
ie, lets say i have two text boxes, side by side, that are filled with some long text contained in a variable.. if the text runs longer than the first box, it just continues right on in the second box.
any ideas?
thnx
- Mick0
It seems possible but I'm too lazy to spend the time to figure it out ;)
You would need to use the TextField .length to figure out how many characters in the first box, then split at character value from the .length above and send the resulting values to the textboxes.
- silencer0
You mean like a 'real' magazine?
- silencer0
sorry that sounded really sarcastic it wasnt meant to be ;) Mick is correct and unfortunately I'm just as lazy as him, sorry. If you find out Post it up heer, I'd like to know how its done.
- punch0
Hi. Here is how I'd do it.
Make two textfields. Name the first 'textboxA' the other 'textboxB' (or whatever).
Here is the script:
------------------------------
textString = "Lorem ipsum....";
textboxA.maxChars = 500;
for(i=0;i
- punch0
Crap. Ironically I ran out of text space on my last post. Go figure.
Here is the script:
------------------------------
textString = "Lorem ipsum ...";
textboxA.maxChars = 500;
for (i=0; i
- punch0
WTF. Something in cyberspace really doesn't want you to get this post. Fuck 'em. Here is a link for you:
- rabattski0
nice script. but that goes character thru character. if you have a pretty long text it'll take some time to execute. quite cpu intensive. and you have to know how many characters do fit in that box. and what happens when you break a word of a the end? i think you should take word length in account as well. if the total characters of the last word is bigger than the maximum then that word goes to the next box. something like that.
i dunno if you can get the .length variable of an empty text box. logically it should be zero because it's empty then again sometimes flash isn't about logic. if you can get a value than that would be the fastest way. and choice, size of typeface plays a role as well in the .length value. but i would try it nonetheless. if you do get a zero (which is more likely) than you prolly need to manually figure out how many characters do fit in those boxes.
interesting effect btw. where did you see it? can you post it up here? want to see it in action. maybe it makes more sense for the coders here.
- Mick0
Give that script a try - I don't think it would be all that intensive... I've done things like replace all spaces with another character in a block of 1000 plus characters and it was instantaneous and didn't seem too CPU intensive.
- unfittoprint0
you could split text into individual paragraphs. Make available an MC in the library with a text>Box with its autoSize set to "left". Make a for in loop and attach this MC to the stage with each array component.
Align them accordingly [ (MC-1)._y = MC._height+MC._y ], update the collumn size and, each time the intended value is reached, reset it and increase the overall width.
- shaft0
How about:
textboxA.text = textString.substr(0, 500);
textboxB.text = textString.substr(500);Improved version that avoids slashing words.
- shaft0
Missing url: http://komercja.art.pl/nt/splitt…
- punch0
nice call shaft. That word breaking issue totally escaped my mind (duh). I haven't tried your version but it looks solid.
Na Zdrowie!
- shaft0
I have another way of splitting text into boxes in mind, with autodetection of the intersecting row. It would be about playing with textField properties scroll, bottomScroll, and maxScroll. You'd just have to add a bunch of line breaks at the end of text in order to be able to scroll it up to the top in the second box.
Cheers ;)
- foster_grin0
max char can get messy
this is a little redundant but it works great::
create two multi line text fields: _f1 and _f2
fill them both with the same var and scroll the second to match where the first ended:
var copy="BLA BLA BLA...";
_f1.htmlText=copy;
_f2.htmlText=copy;
_f2.scroll=_f1.bottomScroll+1;
- foster_grin0
- they have to be the same width and font.