• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

html/iframe in flash animation

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
tweaq
Asked:
tweaq
  • 4
  • 3
1 Solution
 
hsmtpCommented:
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
 
tweaqAuthor Commented:
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
 
hsmtpCommented:
You need to put this AS not in the Symbol, but in the frame.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
hsmtpCommented:
Damn, looks like you're using Flash 6.
Could you switch to Flash MX 2004? Because it provides good html support in textfields.
0
 
tweaqAuthor Commented:
ok, i'll try, and i do have flash mx
0
 
tweaqAuthor Commented:
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
 
hsmtpCommented:
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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now