Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 11, 2009
1 parent 5dae584 commit f414a00
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
Empty file added README
Empty file.
Binary file modified bin-debug/Applications.swf
Binary file not shown.
9 changes: 3 additions & 6 deletions src/Applications.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
}
private function fileLoaded(event : Event):void{
new ThumbnailGenerator(event.currentTarget, ApplicationVars.DEFAULT_THUMB_WIDTH, ApplicationVars.DEFAULT_THUMB_HEIGHT, handleDroppedFile, ApplicationVars.folderToSave);
new ThumbnailGenerator(event.currentTarget, ApplicationVars.DEFAULT_THUMB_WIDTH, ApplicationVars.DEFAULT_THUMB_HEIGHT, handleDroppedFile);
}
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
Expand Down Expand Up @@ -133,13 +133,10 @@
</s:HGroup>

<s:nativeDragEnter>
// Event handler for when something is dragged over to the WindowedApplication

// Only allow files to be dragged in
if (event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT))
{
var files:Array = event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
DragManager.acceptDragDrop(event.currentTarget as WindowedApplication);
var files:Array = event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
DragManager.acceptDragDrop(event.currentTarget as WindowedApplication);
}
</s:nativeDragEnter>

Expand Down
43 changes: 21 additions & 22 deletions src/cc/vamel/utils/ThumbnailGenerator.as
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ package cc.vamel.utils
public var saveToFolder : File = null;

//the callback function need a object as parameters
public function ThumbnailGenerator(loader : Object, width:int, height:int, $callBackFunction : Function = null, saveToFolder : File = null)
public function ThumbnailGenerator(loader : Object, width:int, height:int, $callBackFunction : Function = null)
{

this.saveToFolder = saveToFolder;
Expand Down Expand Up @@ -110,43 +110,42 @@ package cc.vamel.utils
stream.open( outputFile, FileMode.WRITE );
stream.writeBytes( compressedByteArray, 0, 0 );

stream.close();

stream.close();
creationComplete();

}


private function creationComplete():void{
createdFilesIndex++;
if(callBackFunction){
callBackFunction(outputFile);
clearAllObjects();
}
else{
trace('`Files created but no callback function was created');
clearAllObjects();
trace('Files created but no callback function was created');
}

clearAllObjects();

}

//this function clear all objects and invoke the garbage collector of flash
private function clearAllObjects():void{

//this function clear all objects and invoke the garbage collector
private function clearAllObjects():void{
outputFile = null;
byteArrayFromOriginalFile = null;
jpegEncoder = null;
_loader = null;
bmp = null;
bmpd =null;
encoder = null;
img = null;
matrix = null;
ratio = null;
outputHeight = null;
outputWidth = null;
outputByteArray = null;
byteArrayFromOriginalFile = null;
jpegEncoder = null;
_loader = null;
bmp = null;
bmpd =null;
encoder = null;
img = null;
matrix = null;
ratio = null;
outputHeight = null;
outputWidth = null;
outputByteArray = null;

System.gc();
System.gc();
}

}
Expand Down

0 comments on commit f414a00

Please sign in to comment.