A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic text; dynamic gradient fill

  1. #1
    Junior Member scudsucker's Avatar
    Join Date
    Feb 2003
    Location
    Cape Town, RSA
    Posts
    1,509

    Dynamic text; dynamic gradient fill

    Wow. Its been a long time since I asked a question here!

    I'm trying to re-create a tweened banner with gradient filled (and broken apart ) text with dynamic text.

    I'm using this code inside a loop: aTxt is an array of strings populated from an XML object
    code:

    var fmtText:TextFormat = new TextFormat();
    fmtText.font = "TrajanPro";
    fmtText.size = 30;
    fmtText.color = 0xE3D280;
    // ...
    // get the width of the textfields
    var txtMetrics:Object = fmtText.getTextExtent(aTxt[i]);

    this["mv_"+i].createTextField("txt", 2, 0, 4, txtMetrics.textFieldWidth, txtMetrics.textFieldHeight);
    this["mv_"+i].txt.text = aTxt[i].toUpperCase();
    this["mv_"+i].txt.setTextFormat(fmtText);


    I need to use the TextFormat method because thats the only way i can get the width of the newly created text filed, which I use for some maths later.

    Is there any way to use a gradient fill instead of the color 0xE3D280? Or must I make the text as a mask for a gardient fill layer?
    Hariyemadzisawira nhaka yedu! Down the SCUD and win!
    I'm too lazy to read Private Messages.

  2. #2
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    you will need to make a mask
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

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