Archive for the ‘as3Corelib’ Category

as3corelib Tutorial:How to Use JSON Class in Flex

Tooth-Toy-256x256 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.

(more…)

Summary: AS3Corelib Demos of Classes Under the Package com.adobe.utils

Sora-Face 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)  :)

(more…)

as3corelib Tutorial:How to Use XMLUtil Class in Flex

Address-Book-128x128 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.

Search-256x256 Demo | DownloadDownload Full Project

(more…)

as3corelib Tutorial:How to Use StringUtil Class in Flex

papa-smurf-256x256 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”.

Search-256x256 Demo | DownloadDownload Full Project

(more…)

as3corelib Tutorial:How to Use NumberFormatter Class in Flex

Finder-128x128 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.

Search-256x256 Demo | DownloadDownload Full Project

(more…)

as3corelib Tutorial:How to Use IntUtil Class in Flex

Movie-256x256 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.

Search-256x256 Demo | DownloadDownload Full Project

(more…)

as3corelib Tutorial:How to Use DateUtil Class in Flex

date-128x128 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?

Search-256x256 Demo | DownloadDownload Full Project

(more…)

as3corelib Tutorial:How to Use DictionaryUtil Class in Flex

folder 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”.

Search-256x256 Demo | DownloadDownload Full Project

(more…)