Solved

html/iframe in flash animation

Posted on 2004-09-24
7
449 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
embedding a media live encoder stream 3 132
Form submit issue 11 85
Actionscript in Flash 3 58
Download a website to hdd 2 65
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The goal of the tutorial is to teach the user how to how to record live broadcast.

816 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

11 Experts available now in Live!

Get 1:1 Help Now