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 an accessible html version (for search engines, textreaders and people without flash) and a flash version (because the customer insists to use flash even though a html-css-ajax solution would do quite nicely).
What I need is a simple way of getting the text or attributes from the html with a certain id, like <h1 id="flashdataTitle">This is the title</h1>
etc. I'm guessing a few ways it might be possible:
- Somehow use an ExternalInterface.call and do the DOM trickery in JavaScript (wich is probably what I will do, because I'm very familiar with JS and a complete newbie with flash/actionscript, unless you have a better solution)
- Load the xhtml with the Actionscript XML class, and manually traverse the XML looking for the correct id attribute (but this is probably very slow)
- Use XPath with the XML class in actionscript. (I'd like some hints on how to do this, if this is the reccomended way)
- There is actually an Actionscript equivalent to getElementById to use with the XML?
- Allthough my employer hope we don't have to do this: I could rewrite the server side code to output the relevant texts and image urls in a flash-friendly format.
What is the most effective, easiest to implement, and robust-crossbrowser way of doing this? Any totally different ideas?
Please post any ideas even if you think the question have been answered, I'd like to explore all the different possibilities, and allso what disadvantages the proposed solutions have.