07/08: HTML inside XML for flash
Include your HTML tags inside XML for flash
As anybody familiar with XML HTML and Flash that XML can not take characters like <, >, &, " and ' it is possible to use a CDATA node to turn around it but a node value can not take CDATA so what could be a solution.
If you need to have some text coming from a database with html tags supported by Flash such as <b> for bold, <u> underline, <i> italic and others, you will face this problem for sure, I come with a small simple solution, a script replacement so that I can write inside the xml [b] [u] [i] to turn around this problem and here is the AS that can solve this problem:
Let's said we have a text like this :
var tex:String = "This is my text and this is a [b]bold[/b] word";
lets said that text come from an xml node as [ can be used in xml without problem to specify an HTML tag
in my AS code I separate the charachters "[" and "]" with split function, then I replace them with "<" and ">" with join function.
var1 = tex.split("[");
tex = var1.join("<");
var2 = tex.split("]");
tex = var2.join(">");
In my text field, I enable the html by
test_txt.html = true;
Then I point it to our tex text variable
test_txt.htmlText = tex;
Text will be changed to: This is my text and this is a <b>bold</b> word
Simple !!! isn't it :)))
I tried many sites to find a solution to launch the ThickBox with some movies and images inside an html page from a flash file but there was no success, after some trials, here is what I found as solution:
1 - in your flash FLA ActionsScript on the frame write this script:
import flash.external.ExternalInterface;
function b1() {
ExternalInterface.call("tb_show","Your Title of the page","yourpagepath? &keepThis=true&TB_iframe=true&height=400&width=650",false);
}
2 - in your link or button ActionsScript write this script:
on (release) {
b1();
}
3 - in your HTML make sure that the wmode of any flash under the ThickBox is transparent.