Question

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).

Was it helpful?

Solution

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...

OTHER TIPS

flashQuery supports HTML tags and CSS rules for Flash. It transforms flash into a really browser. Here it is: http://www.flashquery.org/

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.

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).

@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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top