Index: lams_common/src/flash/org/lamsfoundation/lams/common/util/MovieClipUtils.as =================================================================== diff -u -r1be488bb41123a87eff76de8d548f8c04eadba4a -rdcbfe4dc416241142165f2d53df2a760d336be0e --- lams_common/src/flash/org/lamsfoundation/lams/common/util/MovieClipUtils.as (.../MovieClipUtils.as) (revision 1be488bb41123a87eff76de8d548f8c04eadba4a) +++ lams_common/src/flash/org/lamsfoundation/lams/common/util/MovieClipUtils.as (.../MovieClipUtils.as) (revision dcbfe4dc416241142165f2d53df2a760d336be0e) @@ -2,11 +2,11 @@ /** * MovieclipUtils */ -class MovieclipUtils { +class MovieClipUtils { - //Declarations - //Constructor - function MovieclipUtils() { + //Declarations + //Constructor + function MovieClipUtils() { } /** @@ -18,11 +18,25 @@ trace("Method not implemented"); return false; } - - public static function doLater():Void{ - + + /** + * Schedules a function to be executed after one frame + * @usage + * import org.lamsfoundation.lams.common.util.* + * doLater(Proxy.create(,,arg1,arg2.....); + */ + public static function doLater(fn:Function,durationObj:Object):Void{ + //Create the clip and attach to root at next available depth + var doLater_mc:MovieClip = _root.createEmptyMovieClip('LFDoLater_mc',_root.getNextHighestDepth()); + //Assign function to clip and set up onEnterFrame + doLater_mc.fn = fn; + doLater_mc.onEnterFrame = function () { + trace('doLater.onEnterFrame'); + //Call the fn, kill the enterframe and remove the clip + fn.apply(); + delete this.onEnterFrame; + this.removeMovieClip(); + } } - - } \ No newline at end of file