A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Better performance: break apart images or text fields on the fly

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    11

    Better performance: break apart images or text fields on the fly

    Currently I coded with AS3 my app in Flash AIR for iOS.
    It seems (my feeling) that using dynamic text fields, created on the fly within a function, has a slower performance for the device than using break apart images.

    I used 4 dynamic text fields on-the-fly with text formats from a non-existing font (Lucida Blackletter). Each textfield is faded in and out, followed by the next textfield in the same way. For the cross-fading I used TweenLite.
    I am wondering if this is the best way to present the cross-fading texts or should I break apart the sentences of each textfield and convert it to MovieClips and then use Linkage to load in the cross-fading function?

    Can someone advice me for the best option for the device?

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Use the Flash Textengine if you did not do so already and don't embed fonts. Movieclips use a lot of memory so try avoiding them.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    I already use this for showing the content with 4 textfields:
    var textFieldFont:Font = new LucidaBlackletter();
    var textFormat:TextFormat = new TextFormat();
    textFormat.size = 50;
    textFormat.align = TextFormatAlign.CENTER;
    textFormat.font = textFieldFont.fontName;
    textFormat.color = 0xFFFFFF;

    var textField1:TextField = new TextField();
    var textField2:TextField = new TextField();
    var textField3:TextField = new TextField();
    var textField4:TextField = new TextField();
    var targetFields:Array = [textField1, textField2, textField3, textField4];

    for (var j:int = 0; j < targetFields.length; j++)
    {
    targetFields[j].defaultTextFormat = textFormat;
    targetFields[j].width = 630;
    targetFields[j].height = 250;
    targetFields[j].border = false;
    targetFields[j].wordWrap = true;
    targetFields[j].x = 40;
    targetFields[j].y = 195;
    targetFields[j].alpha = 0;
    }

    textField1.text = "Met zachte koebelletjes uit een muziekdoosje\n...";
    textField2.text = "op de achtergrond,\n...";
    textField3.text = "schrijft de eeuwige pennenveer\n...";
    textField4.text = "een jaarrond.";

    var i:int = 0;

    function initFades():void
    {
    addChild(targetFields[i]);
    TweenLite.to(targetFields[i], 2, {alpha:1, onComplete:fadeOutFirst});

    function fadeOutFirst():void
    {
    TweenLite.to(targetFields[i], 2, {delay:5, alpha:0, onComplete:fadeInLoop});
    }
    }

    function fadeOutLoop():void
    {
    if (i < 3) {
    TweenLite.to(targetFields[i], 2, {delay:5, alpha:0, onComplete:fadeInLoop});
    } else {
    TweenLite.to(targetFields[i], 2, {delay:5, alpha:0, onCompletenFinishTextInvisible});
    }
    }

    function fadeInLoop():void
    {
    removeChild(targetFields[i]);
    if (i < 3) {
    i++;
    } else {
    i = 0;
    }
    addChild(targetFields[i]);
    targetFields[i].alpha = 0;
    createNewStar(20, 690, 314, true);
    TweenLite.to(targetFields[i], 2, {alpha:1, onComplete:fadeOutLoop});
    }
    Better stick with the code above than replacing it with mc's (regarding the performance of the app)?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    Thanks!
    I will digg into that.

  6. #6
    Junior Member
    Join Date
    Jan 2005
    Posts
    11
    I am not convinced about the benefit of using fte over text fields.
    It seems I need more code of lines to show 4 simple sentences with tfe than using text fields.

    Just to be sure, I ask it again, do I need fte for showing 4 sentences with little format (font and size)?

  7. #7
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I am only showing you what people at Adobe think. The rest is up to you. My opinion is that even you write more lines, if it saves you memory it is worth doing it.
    - The right of the People to create Flash movies shall not be infringed. -

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