Archive for January, 2007

Add Snap Preview Anywhere in the blog

Saturday, January 27th, 2007

I browsed around through other people blogs, some smart flash developer sites, and I found that most of them has a preview link from snap.com.
An interesting addition to a blog site. So here they are in my blog site.
So next time you browse my site, and see a link, you can just hover on the link and see the site preview before you really click on it.
Enjoy …

String Util find and replace

Saturday, January 20th, 2007

Recently, I need a tools to find and replace a string for my flash lite program.

I come up with a quick and easy method to do the swap using string.split and array.join.

Unfortunately this method will not work on Action script 1 / Flash 4 version because it doesn’t support string split with a substring as the delimiter

class StringUtil
{
/**
* @function findReplace
* @description find substring and replace the
* substring with the  new string from the main string
* @param string_source : String
* @param find_string : String
* @param replace_string : String
* @return    String
*/
      public function findReplace( string_source : String, find_string : String, replace_string : String ) : String
      {
            trace( "StringUtils:findReplace invoked" );
            var temp_array : Array = string_source.split( find_string );
            var result_string : String = temp_array.join( replace_string );
            return result_string;
      }
}

can come handy in many other code situation.