FileReference Bug - it just doesn’t load…

20. März 2010

14 Kommentare

While working on Tilerator i found some strange behaviour on FileReference. Code as follows:

private function selectFile():void{
var f:FileReference=new FileReference();
f.addEventListener(Event.SELECT, loadFile);
f.addEventListener(Event.COMPLETE, parseFile);
f.browse();
}

private function loadFile(e:Event){
var fr:FileReference=FileReference(e.target);
fr.load();
}

private function parseFile(e:Event){
var fr:FileReference=FileReference(e.target);
trace('loading completed');
//never fires
}

Problem:
Even a progress event is rarely fired. The File just won’t load. Pretty annoying - especially when you eagerly want to load some data you’ve been storing away before.

Solution:
FileReference f might be eaten by some really motivated garbage collector, though it still has some event listeners attached. Making f a field var helps.

¬ geschrieben von matze in actionscript, flex

Tilerator

20. März 2010

14 Kommentare

My friend Rico is currently doing some iPhone game development in cocos2d and seemed pretty annoyed about the way the textures had to be prepared - so I created a small AIR app to prepare textures for Tiled Map Editor. Drop your PNGs on the app, arrange them as you like, save the comp and the tiled texture. Sounds simple? It is.

screenshot 1

screenshot 2

App has still some flaws, and a bug might occur here and there. If so, let me know - though i won’t promise to fix that within the minute.

If this little tool helps one of you, I’m already happy as this task in Photoshop is something quite annoying and time-consuming. At least I think, and if someone has a solution for that - feel free to post.

And now download Tilerator and take it for a spin. You need AIR.

UPDATE: 27.03.2010
added: possibility to delete image

fixed: after loading .tlc Tilerator composition file, Preview Tiled and Save Tiled did not work

¬ geschrieben von matze in flex, game

Flash Builder 4 Beta 2 - Performance Problem gelöst

26. Oktober 2009

0 Kommentare

Beschreibung: Installation der FlashBuilder 4 Beta 2. Vorher sauber Beta1 deinstalliert. Die Beta 2 ist langsam wie nur was, keine Überprüfung des Codes beim Speichern, und der Compiler kommt und kommt nicht aus der Hefe. Zusätzlich ist der “Debug”-Shortcut weg. Das Teil rendert die Zeichen langsamer, als ich BEIM ÜBERLEGEN tippe.

Lösung: Deinstallation (und Deinstallation FlashCatalyst Beta 1) und Re-Installation, diesmal in Deutsch. Fluppt wie nur was. Ja, die kleinen Dinge des Lebens.

¬ geschrieben von matze in flash, flex

Theme von BenediktRB • Powered by Wordpress • Abonniere den RSS Feed