views:

3638

answers:

5

I want to show HTML content inside FLASH. Is there some way to do this? I am talking about full blown HTML (with JavaScript if possible)

+1  A: 

How complex HTML are we talking about? Simple HTML, like <b> and <i> is supported in text fields if you use the htmlText property. You can also attach a CSS style sheet to the text field for more styling. Have a look at TextField in the Flash API documentation (I'm sure you can just google it).

Theo
+1  A: 

Here is a decent article on how to accomplish that.

@Flubba: I didn't say "great" article, I said "decent" - there is a big difference. Besides, no one else had answered and it had been around a while. I figured a "decent" answer was better than none. I am no Flash expert, so...

Jason Bunting
+2  A: 

You could also try http://motionandcolor.com/

Wrapper is a cross-browser compliant HTML/CSS rendering engine written in ActionScript that sits on top of your standards compliant HTML page.

Javascript might be tricker though.

grapefrukt
A: 

@JasonBunting

Here is a decent article on how to accomplish that.

That's not a great article - it's seven years old and doesn't mention the CSS capabilities of Flash. It covers only the basics of HTML support in Flash.

Adobe have a more authoritative page here: Using HTML text formatting in Flash CS3 Professional

Things have moved on a lot since then. Flash MX 2004 added CSS capabilities and there is a good article from Kirupa.com about that - Using CSS Styles in Flash MX 2004

Don't be thinking you'll just import a modern page into Flash and it'll render - that ain't going to happen. This stuff is for styling text areas. You won't get JavaScript executing because you're reliant on the subset of HTML and CSS that Flash supports in a text object, and Flash has a different object model from a web page.

Flubba
A: 

If it is complex HTML and Javascript, one possible way is HTMLComponent, a method that uses an iframe over your flash to make it appear like the HTML is in your app. There are a few downsides to this method however - most of them described in detail at Deitte.com.

If this can move offline, you could use Air (it has an mx:HTML component built in). Deitte.com has a detail of this technique as well.

81bronco