Overview:
Using what I learned with the Actionscript Javascript Communication Tutorial, and pushing it a little further I’ve set up this example of how flash renders html and css. This is basically a wysiwyg (What you see is what you get) html editor! Natively flash only handles some html and css. Many people have enhanced it’s capabilities with projects and Classes, but I made this to show what is accepted by default as far as html and css is concerned. I know there are specs and many lists about what will work, but to me the best way to know if my code will work is to try and see…
I’ve made this app so if I have a question, I just paste in my html/css and send it to the swf to see it rendered live. This saved me a few headaches, so I thought other might enjoy it as well… So here it is.
Example:
Render your own html and or css in flash. htmlToFlash.html
Here is the flash rendering of some dummy text as html with css applied
Here’s the html interface where I paste in the html and css.
Each supported css property has a corresponding actionscript property, but the naming convention is a little different for css in actionscript. Each actionscript property name is derived from the corresponding CSS property name; the hyphen is omitted and the subsequent character is capitalized. So for example: ‘font-weight’ becomes ‘fontWeight’.
Download:
Here’s the open source files if you want to get your hands dirty.
Let me know if you improve this or even have any questions about it!
Again, note there are only certain HTMl and CSS supported by flash, follow the links for more info.
HTML supported by Flash and CSS supported by Flash