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).
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
@JasonBunting
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.
flashQuery supports HTML tags and CSS rules for Flash. It transforms flash into a really browser. Here it is: http://www.flashquery.org/
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...
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.
You could also try http://motionandcolor.com/
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).