AS3 Textfield New Line not being Recognized

January 14, 2014

I loaded an xml file into a program which was then used to set string based variables. The text from the xml file was contained between CDATA tags and contained the \n character as shown below:

<![CDATA[Directions:\n1. Choose a patient by clicking on a silhouette.\n\n]]>

The AS3 textfield was not recognizing the new line character when set from the xml file and was just displaying the \n within the Textfield so it appeared in the textfield like this:

Directions:\n1. Choose a patient by clicking on a silhouette.\n\n

Finally found a solution from a post from 2008:

Newline characters not recognized when parsing external xml file

Once I added the code recommended on the site:

myText.replace(/\\n/g, "\n");

The new line was recognized in the textfield.

Reminder /g is a flag to globally replace all the occurrences.


Android Mobile Issue – Display local html/xml pages via StageWebView

May 14, 2012

When working on the pocketnotes to go mobile app, I ran into a problem viewing local xml files via the StageWebView component on an Android device. It turns out that special handling is involved which I found out after reading Air on Android: Displaying local web pages in StageWebView.

In essence, you have to copy your read only xml/html files from the installed .apk file on your device, which is located in the application directory, to the application storage directory.

The post has a brief explanation on how to accomplish this with a few lines of code. To make it consistent across android and ios devices, I found a blog discussing Local File Access/Editing for Android and ios.

Testing for the Android OS version using Actionscript 3.0

May 9, 2012

In my previous post, I had run into a problem using XSL transforms on XML files stored on the client side of an Android device. The following will illustrate how I handled the problem using Flex and AS3.

The first thing that I did was in my project mxml file, I added a method that will be called when the app dispatches an Initialize event.

Continue reading

XSL on XML Transform Issue Occurs Client Side on Android Device

May 9, 2012

After uploading the NIM Pocketnotes On The Go app on the Google Play Market, I had a fellow co-worker try it out on their Droid X phone. I had tested the app on my husband’s Motorola Xoom tablet which I had handy and everything was working fine. When the app rendered the Pocket Notes on the Droid it looked AWFUL. All the text was jumbled and there was no text formatting being done. Uh-oh, not good.

Continue reading

Protected: Tag Letters on XML Files for Interactions in NEPP

September 10, 2009

This content is password protected. To view it please enter your password below:

Using XML to display text in Flash Page and/or HTML

September 2, 2009

We have summary content which we use at the end of nutritional instruction. The nutritional instruction is initially rendered in a flash page at the end of a course(The course content is contained in a series of flash based pages). This information also needs to be made available for printing and for possible look up at a later time from an HTML web based page. We call this section our pocket notes and have placed this text info into an xml file.

We decided that with the use of xml we could centralize the information which needs to be displayed and massage it for display in two different contexts. The first view would be within a flash based page and the second within an html based page.

Pocket Notes Text Instructions for xml file:
The pocket notes text (which is to be displayed in both a flash page template and an html browser page) is provided a layout structure with the use of an xml file.

  • This xml file is dynamically loaded into the flash page for display.
  • The xml file is also displayed appropriately in a browser page with the use of an xsl stylesheet.

The xml file was structured using the following format:
Continue reading

Use xml file to display info in swf and html

May 19, 2009

I needed to setup a system where the same data could be viewed/accessed in both a swf file and an HTML file on the web.

I set up the swf file to dynamically load an xml file. The nodes and attributes of the xml would then be parsed and stored in an instance of a class which I named CheatsheetData class(currently known as pocket notes now). Continue reading