dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Lengthy text = massive performance slow down

  1. #1
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262

    Lengthy text = massive performance slow down

    Has anyone experienced a serious performance slow down when dealing with a lot of text and embedded fonts?

    I'm trying to display an article in newspaper column-like format, so I basically have two textfields, side-by-side, hidden beneath a mask. I placed a copy of the article in each textfield (so both textfields are displaying the same article), and then I stagger the second textfield (the one on the right), so that the first visible line is the line that immediately follows the LAST line of the first textfield.... make sense?

    for example:

    both columns contain the same text....

    1 2
    A A
    B B
    C C
    D D
    E E

    ...then i stagger column 2 by shifting it upwards in Y...

    1 2
    A B
    B C
    C D
    D E
    E F

    Now the columns are offset, so when you see them behind the mask, you see A in column 1 and B in column 2. When the user changes page, i shift the two columns up in Y by the same value, and you now see C and D.

    anyway, as you can imagine, the code for turning pages is super simple....
    Code:
    var turnPage:Function = function(pageDirection:String) {
    	if (pageDirection == "forward") {
    		textContainer._y -= maskMC._height;
    	} else {
    		textContainer._y += maskMC._height;
    	}
    };
    ...and yet, because there is so much text, everything slows to a crawl after a while and my CPU usage jumps to 100%. it literally takes 10 seconds to shift the textfields up in Y... ridiculous!

    i'm relatively certain this has to do with embedding fonts, as it doesn't happen otherwise. the problem is, i need to embed fonts because i need to work with a particular font.

    anyone have any idea how i can resolve this issue? is flash just not set up to handle a lot of text??

  2. #2
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    i pulled up my windows task manager to see what the hell was going while my script was running, and amazingly enough, every time i turn a page, the memory usage for flash increases, so if i turn enough pages, i eventually run out of RAM, and that's when the massive performance slow down occurs... what the hell??

    this does not happen when embed fonts is turned off.

    anyway, if anyone has a workaround, let me know please!

  3. #3
    Senior Member
    Join Date
    Mar 2001
    Location
    Location : Location
    Posts
    131
    How big is the text. Can you not split it into page size chunks when you load it - maybe counting characters - this may take a little longer at the start but might save time during. Are the fonts being applied after the text is moved into position.
    this[MCr.i + 'm_not_ok']._lyric = "you sing the words but you don't know what they mean";

  4. #4
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    sorry, never posted back, but the problem is limited to preview mode within the Flash application (i.e. when you preview the SWF within the Flash authoring environment by pressing CTRL-F12). it works fine in a browser. not sure why, but whatever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center