Is there anything similar to getElementById in actionscript?
I\'m trying to make a prototype of a flash page wich gets it\'s data from a xhtml file. I want to have both
Since you said your input would be XHTML, you can do it with XPath:
import mx.xpath.XPathAPI;
var elementId:String = "flashdataTitle";
var elementPath:String = "//h1[@id'" + elementId + "']";
found_elements = XPathAPI.selectNodeList(xhtml.firstChild, elementPath);
if (found_elements.length == 1) {
trace(found_elements[0]);
}
The code example is inspired from here, where you also can find some mode detail on XPath and ActionScript.
AS3 has it's own XPath Library, the general approach would be the same.