tags:

views:

10

answers:

0

I need a way to have text that may include bullets in a XLIFF file (so that it is translateable and load it in a dynamic text field using as2. I was informed that using CDATA in the XLIFF file was a bad idea so I came up with a work around where in place of

<li> tags

I have [*] & [/*]

In the flash I am replacing these with list item tags and outputing into a dynamic text field

import mx.lang.Locale;
Locale.setLoadCallback(localeListener);

Locale.loadLanguageXML(lang_cb.en);
var rtext:String;
function localeListener(success:Boolean):String {
    if (success) {
  rtext = Locale.loadString("IDS_TEXT3");

  trace ("This is new rtext:" + rtext);
  output2 = stringReplace(rtext, "[*]", "<li>");
  output3 = stringReplace(output2, "[/*]", "</li>");
  text3.htmlText = output3;
  return rtext;
    } else {
        trace("failed");
    }

}

function stringReplace(block:String, find:String, replace:String):String
{
return block.split(find).join(replace);
}

If there is a better way to do this I would be very interested, failing that how can I refactor the stringReplace function I have so it can be called by something like:

replace(rtext);

If I try to move the 2 calls to stringReplace outside of the localeListener function all I get is undefined.

I hope this make some sence to someone more intelligent then me out there.

Thanks

Jamie