A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: MX2004 - "font color" property not working in loop populated text field

  1. #1
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575

    MX2004 - "font color" property not working in loop populated text field

    Hi,

    I have the following script which works fine in the "Text Area" component of MX2004:

    code:
    _root.dym_txt.html = true;
    _root.trink_array = ["Carp", "Cod", "Bream"];
    _root.trinity_array = new Array();
    for (var g = 0; g<=2; g++) {
    _root.trinity_array[g] = _root.trink_array[g];
    some_str += "<br>"+_root.trinity_array[g]+"</br>";
    }
    _root.dym_txt.text = some_str;



    However, if I try & change the “color” property instead of just putting a break <br> in the text Flash throws it’s toys out of the pram & wont let me use the code to obtain this:

    _root.dym_txt.html = true;
    _root.trink_array = ["Carp", "Cod", "Bream"];
    _root.trinity_array = new Array();
    for (var g = 0; g<=2; g++) {
    _root.trinity_array[g] = _root.trink_array[g];
    some_str += "<font color="#92A312">"+_root.trinity_array[g]+"</font>";
    }
    _root.dym_txt.text = some_str;

    The error message:

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: Unexpected '}' encountered
    }

    Comes up?

    Any help please.
    You will know everything when you know you never will.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Instead of double quote marks, try using single quote marks around the color number...
    Code:
    _root.dym_txt.html = true;
    _root.trink_array = ["Carp", "Cod", "Bream"];
    _root.trinity_array = new Array();
    for (var g = 0; g <= 2; g++) {
    	_root.trinity_array[g] = _root.trink_array[g];
    	some_str += "<font color='#92A312'>" + _root.trinity_array[g] + "</font>";
    }
    _root.dym_txt.text = some_str;

  3. #3
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575
    Thanks dawsonk I will give that a go.

    Enjoy the rest of your day!
    You will know everything when you know you never will.

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