Frontal Classes

In the html2flex Frontal project it is possible to interact directly with the components responsable of the html parsing and of the generation of the Flex objects.

 

HtmlParser

The class which parses the html code is the HtmlParser class; it has the method parse with the input parameter represented by the html code; this method delivers an Element instance built upon the html code, populated with all the nested Element children.

FlexHtmlRenderer


The class which gives birth to all the Flex objects is the FlexHtmlRenderer class; this class has two important static methods that are renderElement and  renderIntoElement; the first one accepts as input an Element object returning the UIComponent generated, the second one accepts the as first input the Element object an then the UIComponent in which it is desired to insert the components generated by Frontal.

var container : Container = new Canvas();

var el : Element = HtmlParser.parse(htmlString);

FlexHtmlRenderer.renderIntoElement(el, container);

or

var el : Element = HtmlParser.parse(htmlString);

var container : Container = FlexHtmlRenderer.renderElement(el);