Counting number of words in a String.
Here is a simple code to get the word count. To ease up the process, I do not count the words that are not separated by space For Example “Mr.Arul” will still be counted as one word. but it makes sure whitespace is not counted as words Here is the code 1234567891011121314151617181920function wordcount(txt) { if...
Read MoreXML pretty printing and color highlighting .
We used to build many Flash Applications which exports data as XML. How about pretty printing it with colors? Before writing my own code I searched to find any existing code and found this code written by Evgeniy Potapenko in prototype. It does the basic pretty printing part, but it had few problems in handling the text nodes. It adds tabs before text nodes and unlike the native .toString()...
Read MoreConverting Date Strings back to Date.
We all know that trace(new Date()) traces the date as a string that looks like “Mon Jul 12 13:20:09 GMT+0800 2004″ How to convert this String back to Date? There is no built in method, so I’ve written this function to do that. Usage: #include “getDateFromString.as” //sample date in Pacific Daylight Time var str = “Sun Aug 11 17:00:00 GMT-0700...
Read MoreUnicode escape notations are lost while auto formating ActionScipt!
I found this bug while working on my “content management solutions for languages”, project . If you want to use unicode characters that are not supported by your system’s codepage in your actionscript with out using external ‘.as’ files, the only way is to use Unicode escape notations in the format “\uXXXX” where the 4 digits specified are the UTF...
Read MoreXML Pre Processing for handling XML
When we want to handle external Html files as XML, say for example using my transformTags() code, we face the problem of unclosed tags like <br> tag. To fix this problem we can overwrite onData method of XML object as shown below. It basically replaces all <br> tags with <br/> before parsing the XML data [UPDATE] included the ActionScript 3 version as well It became lot...
Read MoreStripping HTML Tags using XML
There is a thread going on in flashcoders mailing list about how to stripp the HTML tags in the string. Here is my version to do the same using XML. It can be used to remove specific tags from the given string. Even though we can use flash textField for this purpose (setting the .htmlText property and getting .text property) the following method gives more options and flexibility. [UPDATE]...
Read MoreMIT Open Source Courseware!!
If you are interested in developing e-learning content you may find this link useful. MIT is Open Sourcing some of its courses and course content.
Read MoreProblem importing sound?
When our flash file becomes big and complex we often face this problem. When we try to import the audio we get “One or more files were not imported because there were problems reading them” even when you are sure that the audio format is flash compatible. Solution? Import the audio into a new blank flash file once done drag the imported audio from this library to your project files...
Read More

