wait a frame before doing work so screen updates with step information
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/d5c27ef5 Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/d5c27ef5 Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/d5c27ef5 Branch: refs/heads/develop Commit: d5c27ef539713e314eb29097ce7cff3ab13a5b6d Parents: b289eff Author: Alex Harui <[email protected]> Authored: Wed Jan 15 15:18:02 2014 -0800 Committer: Alex Harui <[email protected]> Committed: Wed Jan 15 15:18:02 2014 -0800 ---------------------------------------------------------------------- ant_on_air/src/org/apache/flex/ant/tags/Copy.as | 22 +++++++++++++++++--- ant_on_air/src/org/apache/flex/ant/tags/Move.as | 22 +++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d5c27ef5/ant_on_air/src/org/apache/flex/ant/tags/Copy.as ---------------------------------------------------------------------- diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Copy.as b/ant_on_air/src/org/apache/flex/ant/tags/Copy.as index 0b28c3f..655afb6 100644 --- a/ant_on_air/src/org/apache/flex/ant/tags/Copy.as +++ b/ant_on_air/src/org/apache/flex/ant/tags/Copy.as @@ -18,6 +18,7 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.ant.tags { + import flash.events.Event; import flash.filesystem.File; import mx.core.IFlexModuleFactory; @@ -155,6 +156,9 @@ package org.apache.flex.ant.tags ant.output(ant.formatOutput("copy", s)); } + private var srcFile:File; + private var destFile:File; + override public function execute(callbackMode:Boolean, context:Object):Boolean { var retVal:Boolean = super.execute(callbackMode, context); @@ -162,7 +166,7 @@ package org.apache.flex.ant.tags return retVal; try { - var srcFile:File = File.applicationDirectory.resolvePath(fileName); + srcFile = File.applicationDirectory.resolvePath(fileName); } catch (e:Error) { @@ -174,7 +178,7 @@ package org.apache.flex.ant.tags } try { - var destFile:File = File.applicationDirectory.resolvePath(toFileName); + destFile = File.applicationDirectory.resolvePath(toFileName); } catch (e:Error) { @@ -193,8 +197,20 @@ package org.apache.flex.ant.tags s = s.replace("%1", "1"); s = s.replace("%2", destFile.nativePath); ant.output(ant.formatOutput("copy", s)); - srcFile.copyTo(destFile, overwrite); + if (callbackMode) + { + ant.functionToCall = doCopy; + return false; + } + + doCopy(); return true; } + + protected function doCopy():void + { + srcFile.copyTo(destFile, overwrite); + dispatchEvent(new Event(Event.COMPLETE)); + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d5c27ef5/ant_on_air/src/org/apache/flex/ant/tags/Move.as ---------------------------------------------------------------------- diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Move.as b/ant_on_air/src/org/apache/flex/ant/tags/Move.as index 244e4ce..a4fab36 100644 --- a/ant_on_air/src/org/apache/flex/ant/tags/Move.as +++ b/ant_on_air/src/org/apache/flex/ant/tags/Move.as @@ -18,6 +18,7 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.ant.tags { + import flash.events.Event; import flash.filesystem.File; import mx.core.IFlexModuleFactory; @@ -155,6 +156,9 @@ package org.apache.flex.ant.tags ant.output(ant.formatOutput("move", s)); } + private var srcFile:File; + private var destFile:File; + override public function execute(callbackMode:Boolean, context:Object):Boolean { var retVal:Boolean = super.execute(callbackMode, context); @@ -162,7 +166,7 @@ package org.apache.flex.ant.tags return retVal; try { - var srcFile:File = File.applicationDirectory.resolvePath(fileName); + srcFile = File.applicationDirectory.resolvePath(fileName); } catch (e:Error) { @@ -183,7 +187,7 @@ package org.apache.flex.ant.tags destFileName = toFileName; try { - var destFile:File = File.applicationDirectory.resolvePath(destFileName); + destFile = File.applicationDirectory.resolvePath(destFileName); } catch (e:Error) { @@ -202,8 +206,20 @@ package org.apache.flex.ant.tags s = s.replace("%1", "1"); s = s.replace("%2", destFile.nativePath); ant.output(ant.formatOutput("move", s)); - srcFile.moveTo(destFile, overwrite); + if (callbackMode) + { + ant.functionToCall = doMove; + return false; + } + + doMove(); return true; } + + protected function doMove():void + { + srcFile.moveTo(destFile, overwrite); + dispatchEvent(new Event(Event.COMPLETE)); + } } } \ No newline at end of file
