views:

27

answers:

0

I have thousands of quiz questions in a database which are in RTF format. The questions only change maybe once a month. At runtime, I need to choose a random subset of questions and display those questions in Flash/Flex. The formatting of the questions go beyond the capabilities of the RichText control or the HTML capabilities of a Label control. I found this, and I'm still trying to understand it, but I'm not sure it is what I am looking for:

Here is the way I'm thinking of doing it, but other suggestions would be welcome:

Using a Perl library, I can convert the RTF to HTML on the server:

<p>This sentence contains <strong>bold text</strong>.</p>

From here I could convert the HTML into MXML and send it to the client Flex app:

<s:RichText>
  <s:Content>
    This sentence contains <s:span fontWeight="bold">bold text</s:span>.
  </s:Content>
</s:RichText>

Then I could write some ActionScript to parse this and actually create the UI controls using flash.utils.getDefinitionByName().

To clarify, my question is how can I use actionscript to convert HTML with things like bold text and tables into something I can display in flash? Would converting the HTML into something like MXML be the way to go?