PDA

View Full Version : using HTML in MX 2004


TheJazzMan
04-15-2005, 05:54 PM
Greetings everyone! Brand new member on the forums and a new "rookie" FlashMX 2004 user.

Our client requires the use of "formatted" text on all project screens and I'm wondering how best to do that in Flash MX 2004. Typically this formatted text contains bolded keywords, specific colors for user instructions, etc. In addition, the text often contains project-specific acronyms, and they have to be bolded, colored green AND clickable so that a definition for that acronym appears onscreen if the user clicks the acronym. Finally, the text may contain website hyperlinks, so they have to be blue and able to hit web sites when clicked.

Each screen of the program will have such text, so it will be a considerable amount of text for the entire project.

Having absolutely no experience with this kind of thing in Flash, I'm wondering the best way to get this text into Flash and allow for interactivity as well. Do most people use external HTML files for this kind of thing then somehow import them into dynamic Flash text fields?

Ideally I'd like to have a single text file for each "module" of the program, and read the text into Flash as needed. I'd prefer not to have individual text files for each screen since that would involve a couple of hundred individual text/HTML files.

Have any of you done this kind of thing before and if so, how can it be done?

Thanks everyone!!

JazzMan

Xeef
04-15-2005, 06:11 PM
hi and welcome to As.Org

lockup "TextField.htmlText" in the help whit it flash can show html formated text but it suport just a handfull of TAG's
Anchor tag (<a>)
Bold tag (<b>)
Break tag (<br>)
Font tag (<font>)
Image tag (<img>) // think this is working F7+ in a proper way
Italic tag (<i>)
List item tag (<li>)
Paragraph tag (<p>)
Span tag (<span>)
Text format tag (<textformat>)
Underline tag (<u>)

TheJazzMan
04-18-2005, 12:17 PM
Greeting everyone. :-)

I am being asked to build a software simulation application in Flash, and the application could end up being several hundred screens in length. Each of the screens would need a paragraph of two of formatted text, along with hyperlinks for web sites. HTML seems the logical choice, but is there another option? (Currently I use RTF text files in Authorware for this purpose.)

Since I posted my initial question I have found several samples that load HTML into Flash. Obviously Flash CAN load HTML files, with some restrictions as to what tags it will support. I can live with that as I only really need the bold and color tags along with hyperlinks for websites. One thing that I have NOT seen in any samples is the ability to load multiple "pages" of HTML. Every sample loads a simple, one paragraph HTML file and that is all.

Ideally I would like Flash to load one external file (HTML, RTF, etc.) of some sort per section or module and somehow parse the file and display the required text on each screen. I'd rather not have each screen in Flash have its own HTML file, as I would end up with several hundred individual HTML files. No way would the client accept that.

Has anyone done this, or anything similar, before? Are there any alternatives besides HTML that would allow individual sections of formatted text to be used in Flash? Being brand new to Flash, I have not seen any samples of this. Any tips, suggestions or ideas are welcomed.

Thanks!

Xeef
04-18-2005, 02:33 PM
try this (as a start)

DATA_FROM_SERVER = "<b> this is bold text and this is <RED>RED</b><i><GREEN> this is Italic text and all GREEN</i><A HREF='http://www.google.com'>lets <BLUE>GOOGLE</A><RED>CLICK ME";
DATA_FROM_SERVER = DATA_FROM_SERVER.split("");
_root.createTextField("T1", 1, 0, 0, 300, 200);
_root.createTextField("T2", 2, 0, 100, 300, 200);
_root.createTextField("T3", 3, 0, 200, 300, 200);
styles = new TextField.StyleSheet();
X = {color:"#ff0000", fontFamily:"Arial", fontSize:"20px"};
styles.setStyle("RED", X);
X = {color:"#00ff00", fontFamily:"Arial", fontSize:"20px"};
styles.setStyle("GREEN", X);
X = {color:"#0000ff", fontFamily:"Arial", fontSize:"30px"};
styles.setStyle("BLUE", X);
T1.html = true;
T1.styleSheet = styles;
T2.html = true;
T2.styleSheet = styles;
T3.html = true;
T3.styleSheet = styles;
T1.htmlText = DATA_FROM_SERVER[0];
T2.htmlText = DATA_FROM_SERVER[1];
T3.htmlText = DATA_FROM_SERVER[2];

TheJazzMan
04-18-2005, 03:05 PM
Thanks for the sample code and taking the time to respond Xeef. I will work with this code a bit and see if I can get it to work.

Sounds like HTML in combination with style sheets and arrays might do the trick.