Solved

html/iframe in flash animation

Posted on 2004-09-24
7
435 Views
Last Modified: 2013-11-19
I'm making a website, and i have a flash template. Right now when you click on the navigation buttons, it loads some text to the right. But i want it to load an html file, so that I can just edit the html file and upload it without having to redo the flash animation and upload it every time i update my site. I would like to be able to add images in the html, and maybe some basic formatting.
By the way, I haven't used flash in a while, so i guess im a n00b again.

Thanks
0
Comment
Question by:tweaq
  • 4
  • 3
7 Comments
 
LVL 6

Accepted Solution

by:
hsmtp earned 250 total points
ID: 12149730
First of all, make your HTML file in standarts of XHTML, so it will be totally clear as XML.
Then you'll need to use UTF-8 encoding.

And then just create dynamic texfield on the stage, name it somehow, f.i. "theText".

Add DataBinding Classes to your library (Window -> Other Pannels -> Common Libraries -> Classes)

And use this AS:

import mx.xpath.XPathAPI;

txt = new XML();
txt.ignoreWhite = true;
txt.load("index.html");

txt.onLoad = function () {
      path = "/html/body";
      tempXML = mx.xpath.XPathAPI.selectNodeList(txt.firstChild, path);

      for (i=0; i<tempXML[0].childNodes.length; i++) {
            _root.theText.htmlText += tempXML[0].childNodes[i];
      }
}

And here it is - your html inside textfield. Don't forget to turn on the textfield option "render text as HTML".

Additionally you may apply CSS to this textfield.
0
 
LVL 1

Author Comment

by:tweaq
ID: 12152438
Ok, i added the databinding classes, and put the action script on it. i named the dynamic textfield to theText, and set render as html. i changed the html to mine (news.html). and i made it xhtml (not sure how to do the UTF-8 encoding). and i have the html in the same place as the flash. when i test the movie, it gives me 5 errors, and it plays the movie, but it doesn't show any text and it shows the databinding classes icon.

here are the errors
**Error** Symbol=info, layer=info, frame=21:Line 1: Syntax error.
     import mx.xpath.XPathAPI;

**Error** Symbol=info, layer=info, frame=21:Line 3: Statement must appear within on/onClipEvent handler
     txt = new XML();

**Error** Symbol=info, layer=info, frame=21:Line 4: Statement must appear within on/onClipEvent handler
     txt.ignoreWhite = true;

**Error** Symbol=info, layer=info, frame=21:Line 5: Statement must appear within on/onClipEvent handler
     txt.load("news.html");

**Error** Symbol=info, layer=info, frame=21:Line 7: Statement must appear within on/onClipEvent handler
     txt.onLoad = function () {

Total ActionScript Errors: 5        Reported Errors: 5

0
 
LVL 6

Expert Comment

by:hsmtp
ID: 12156731
You need to put this AS not in the Symbol, but in the frame.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 6

Expert Comment

by:hsmtp
ID: 12156736
Damn, looks like you're using Flash 6.
Could you switch to Flash MX 2004? Because it provides good html support in textfields.
0
 
LVL 1

Author Comment

by:tweaq
ID: 12163980
ok, i'll try, and i do have flash mx
0
 
LVL 1

Author Comment

by:tweaq
ID: 12164106
well i got it down to 1 error: import mx.xpath.XPathAPI;
but im going to use just the menu as flash, but thanks though, and i'll give you the points
0
 
LVL 6

Expert Comment

by:hsmtp
ID: 12167607
It's possible not to use x-path at all. If you will have html file started from <body> tag (without <html> and <head> tags) then you will be able to use common XML parsing methods.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now