Just sharing very small class that i use on daily business. First function is simply silent DisplayObject removal. Second one is a deep comparison scan of two objects, very useful in flex
[cc lang=”actionscript”]
package com.riawolf.utils
{
import flash.display.DisplayObject;
/**
* …
* @author me
*/
public class RandomUtils
{

public static function cleanRemoveChild(value:DisplayObject):void {
if (value) {
if (value.parent) {
value.parent.removeChild(value);
}
}
}

public static function isEqual(a:Object, b:Object):Boolean {
if (a !== b) {
return false;
}
for (var key:* in a) {
if (!isEqual(a[key], b[key])) {
return false;
}
}
for (key in b) {
if (!isEqual(a[key], b[key])) {
return false;
}
}
return true;
}
}

}
[/cc]

Categories: Blog

0 Comments

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.