This class provides encoding and decoding of the JSON format. This demo shows how to encode an object to a JSON-formate string and how to decode a JSON-formate string to an object. It’s really simple with this class provided by as3corelib library.
October 6th, 2008
This class provides encoding and decoding of the JSON format. This demo shows how to encode an object to a JSON-formate string and how to decode a JSON-formate string to an object. It’s really simple with this class provided by as3corelib library.
September 19th, 2008
The corelib project (http://code.google.com/p/as3corelib/) is an ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript 3. It seems useful for us developers. However, there are no articles or tutorials from the project home. I guess the usage of this library is too simple to provide tutorials, so I can find mere “not yet” from the resources page (http://code.google.com/p/as3corelib/wiki/Resources). But I think it’s better to show something for action script new comers, which are the origin of these serial of articles–It is why I decided to write some tutorials about as3corelib.(Maybe more and more open source libraries)
September 10th, 2008
XMLUtil class contains methods which encapsulate small pieces of codes to process XML. With xml element, we want to get the previous element or the next element sometimes. However, XML class only provides methods “parent ()” and “children ()” to help use. No such methods exist. Well, the methods “getNextSibling” and “getPreviousSibling” of XMLUtil provide us simple way to handle this. Another useful method is “isValidXML”, which is used to check whether a string is formatted as XML.
September 9th, 2008
StringUtil class contains static utility methods for manipulating Strings. It simplifies the way to handle string values to meet the faults of StringUtil defined in package mx.util. For example, I want to remove all the string “mx:” in the StringUtilDemo.mxml. Just call the method like StringUtil.remove(theContent,”mx:”). However, the method is intrinsic case sensitive. So if I call the method like StringUtil.remove(theContent,”MX:”), it doesn’t make sense. The same as the method “replace”.
September 7th, 2008
NumberFormatter class contains static utility methods for formatting Numbers. Now, there is a mere method defined. The method addLeadingZero “Formats a number to include a leading zero if it is a single digit between -1 and 10.” , simple but very useful.
I found codes “returnString+=NumberUtil.addLeadingZero(dateToFormat.getDate());” from internet. We can see that this is what we need when we do such things, to format year, month, day, hour, minute, second or others whatever.
September 5th, 2008
Int util class contains reusable methods for operations pertaining to int values. It provides convenient ways to rotate int values and to get string of int value in Hex format with specified endian code.
“rol” and “ror” are similar to “>>” and”<<” operators, except that these two methods are circular, with the bits shifted out one end returning on the other end. These methods can be to the left or right.
September 4th, 2008
DateUtil class contains static utility methods for manipulating and working with Dates. This is a useful class to simplify the date processing for programmers. For example, I want to know the day name of date August 10, 1983. What should we do with DateUtil? As we know, DateFiled provide a static method named stringToDate(). So, I get the day name of August 10, 1983 like this: DateUtil. getFullDayName (DateField. stringToDate(“08/10/1983”,”MM/DD/YYYY”)). What should we do without DateUtil?
September 2nd, 2008
DictionaryUtil class provides an easy way to access the keys collection and values collection of an existing Dictionary object. However, with the source of DictionaryUtil class, I noticed the difference between “for in” and “for each in”.