Link to home
Start Free TrialLog in
Avatar of t_rice
t_rice

asked on

Load the text and text colour from a text file

Hi,

You have solved a problem we were having earlier on ID: 22470495 (Control Flash stage background colour using External Text File) and we now have another one.

How to load the text and text colour from a text file, different line of text with different colour control in one text file.

Many thanks
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Create a new FLA file... and save it as htmlTextTest.fla...
Create a textField on the stage and make it multiline, html enabled and give it an instance name of content_txt...
Create a new layer and select the frame 1 of it and add this script...

var txt_lv:LoadVars = new LoadVars();
txt_lv.onLoad = function (ok)
{
      if (ok)
      {
            content_txt.htmlText = this.textContent;
      }
      else
      {
            trace("Error loading text file...");
      }
}
txt_lv.load("content.txt");

Save the file...
Open up the notepad and paste this and save it as content.txt file in the same directory...

textContent=<font size='24' color='#0000FF'>This is blue, 24 point text.</font> <font size='36' color='#FF0000'>This is red, 36 point text.</font> <font size='16' color='#00FF00'>This is green, 16 point text.</font>

Go back to Flash and test the FLA file to see if it is working...  :)

CyanBlue
Avatar of t_rice
t_rice

ASKER

Hi,
Thanks for getting back.  Below is what we've tried and it's not working completely.  Its only text apple <font that appears, no colour.  We also, need need control of the alpha of the text.

/ ******* Background ******** //

// Background01
&BGcolor1=0xFF6600&

// Background02
&BGcolor2=0x000000&



// ******* Title Color ******** //

&Tcolor1=0xFFFFFF&



// ******* Title ******** //

// Tittle 1-1
&tittle11=MINALE&
&tittle11a=TATTERFIELD&










// ******* Settings ******** //

&textlabels=yes&

// ******* Background ******** //

// Background01
&BGcolor1=0xFF6600&

// Background02
&BGcolor2=0x000000&



// ******* Title Color ******** //

&Tcolor1=0xFFFFFF&



// ******* Title ******** //

// Tittle 1-1
&tittle11=name&
&tittle11a=name&










// ******* Settings ******** //

&textlabels=yes&


Thanks
Well...  I don't really understand what you said...  Did you try what I have provide and see if it worked for you or not???

FYI, you cannot set the text alpha value unless you embed the font for it...

CyanBlue
Avatar of t_rice

ASKER

Hi, sorry for not being clear.

Yes, we tried to use what you gave us but it only appears <font. also can we set the text as a moive clip and make it alpha 40 %?

Thanks again :)
ASKER CERTIFIED SOLUTION
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of t_rice

ASKER

Thanks, we tried it again and it worked, sorry about that. :)
Not a problem...  Glad to hear that you've got it working...  :)

CyanBlue