Scaleform batch Export
I work with Scaleform now for quite some time, and everyone who knows the Scaleform workflow is familiar with the GFxExport Tool. It is a cmd program to convert .fla files in to .gfx files. But it is uncomfortable as hell if it is not connected in to a workflow and you have to convert your files by hand. I always wanted to write my own application to make this process easier, but I didn’t hat time jet to make it yet.
But there are always two ways. I wrote a little batch file that creates a subfolder and export all the necessary .gfx files and images in to it. Only problem is, you have to set it up the first time you need it:
EDIT: I found out I am not the first one who had this idea. I discovered that there are batch files already in the Scaleform Demo Projects, there had some solutions that where nicer than mine, so i have updated my script:
- @echo off
- cls
- echo.
- rem ===========================================================================================
- rem This file originated from the scaleform example projects and was edited by konrad koch
- rem addictedtocreation.com If you have remarks or an idea to optimize it, let me know
- rem ===========================================================================================
- set resourceDir=.
- if not "%1" == "" (set resourceDir=%1)
- echo resourceDir("%resourceDir%")
- set resourceFile=yourSWFfilename.swf
- rem ###########################################################################################
- rem ===========================================================================================
- rem IMPORTANT: CHANGE THE NAME OF THE SUBFILE YOU WANT TO HAVE YOUR EXPORT!
- rem CURRENTLY IT IS "data". The folder will be deleted each time you runn the script.
- rem So you have always the newest files
- rem ===========================================================================================
- rem ###########################################################################################
- set resourceCompiledDir=%resourceDir%\data
- echo Deleting folder "%resourceCompiledDir%"
- if exist %resourceCompiledDir% (rd /s /q %resourceCompiledDir%)
- rem ###########################################################################################
- rem ===========================================================================================
- rem IMPORTANT: CHANGE THE PATH TO YOUR GFXEXPORT.EXE PATH!
- rem ===========================================================================================
- rem ###########################################################################################
- set gfxexportApp="C:\Program Files (x86)\Scaleform\GFx SDK 4.0\Bin\gfxexport.exe"
- echo GFxExport("%gfxexportApp%")
- rem ###########################################################################################
- rem PRESELECTION:
- rem ###########################################################################################
- echo.
- echo How do you want to export the files?
- echo 1. TGA export:
- echo 2. DDS export with uncompressed DXT1:
- echo 3. DDS export with uncompressed DXT1 and compressed DXT5 with alpha:
- :selection
- set /P wahl=please select:
- if /i "%wahl%"=="1" goto:tga
- if /i "%wahl%"=="2" goto:dxt1
- if /i "%wahl%"=="3" goto:dxt5
- echo Wrong selection!
- goto:selection
- :tga
- echo.
- echo Exporting files TGA...
- %gfxexportApp% %resourceDir%\%resourceFile% -d %resourceCompiledDir%-tga
- pause
- goto:eof
- :dxt1
- echo.
- echo Exporting files DXT1...
- %gfxexportApp% -i DDS -d0 %resourceDir%\%resourceFile% -d %resourceCompiledDir%-dxt1
- pause
- goto:eof
- :dxt5
- echo.
- echo Exporting files DXT1 and DXT5...
- %gfxexportApp% -i DDS -d5 %resourceDir%\%resourceFile% -d %resourceCompiledDir%-dxt5
- pause
- goto:eof
@echo off
cls
echo.
rem ===========================================================================================
rem This file originated from the scaleform example projects and was edited by konrad koch
rem addictedtocreation.com If you have remarks or an idea to optimize it, let me know
rem ===========================================================================================
set resourceDir=.
if not "%1" == "" (set resourceDir=%1)
echo resourceDir("%resourceDir%")
set resourceFile=yourSWFfilename.swf
rem ###########################################################################################
rem ===========================================================================================
rem IMPORTANT: CHANGE THE NAME OF THE SUBFILE YOU WANT TO HAVE YOUR EXPORT!
rem CURRENTLY IT IS "data". The folder will be deleted each time you runn the script.
rem So you have always the newest files
rem ===========================================================================================
rem ###########################################################################################
set resourceCompiledDir=%resourceDir%\data
echo Deleting folder "%resourceCompiledDir%"
if exist %resourceCompiledDir% (rd /s /q %resourceCompiledDir%)
rem ###########################################################################################
rem ===========================================================================================
rem IMPORTANT: CHANGE THE PATH TO YOUR GFXEXPORT.EXE PATH!
rem ===========================================================================================
rem ###########################################################################################
set gfxexportApp="C:\Program Files (x86)\Scaleform\GFx SDK 4.0\Bin\gfxexport.exe"
echo GFxExport("%gfxexportApp%")
rem ###########################################################################################
rem PRESELECTION:
rem ###########################################################################################
echo.
echo How do you want to export the files?
echo 1. TGA export:
echo 2. DDS export with uncompressed DXT1:
echo 3. DDS export with uncompressed DXT1 and compressed DXT5 with alpha:
:selection
set /P wahl=please select:
if /i "%wahl%"=="1" goto:tga
if /i "%wahl%"=="2" goto:dxt1
if /i "%wahl%"=="3" goto:dxt5
echo Wrong selection!
goto:selection
:tga
echo.
echo Exporting files TGA...
%gfxexportApp% %resourceDir%\%resourceFile% -d %resourceCompiledDir%-tga
pause
goto:eof
:dxt1
echo.
echo Exporting files DXT1...
%gfxexportApp% -i DDS -d0 %resourceDir%\%resourceFile% -d %resourceCompiledDir%-dxt1
pause
goto:eof
:dxt5
echo.
echo Exporting files DXT1 and DXT5...
%gfxexportApp% -i DDS -d5 %resourceDir%\%resourceFile% -d %resourceCompiledDir%-dxt5
pause
goto:eofHow to use it:
Coppy the file in to a textfile, change atributes of the .swf filename in side of the textfile and the path of your gfxexporter. Then change the file name from whatever.txt to whatever.batch. Save and run the batch file.
Select which preset you want and the project will convert your files in ta a data-tga, data-dxt1 or data-dxt5 folder.
If you have multible files you can add them on the bottom. SO instead of:
- %gfxexportApp% %resourceDir%\%resourceFile% -d %resourceCompiledDir%-tga
%gfxexportApp% %resourceDir%\%resourceFile% -d %resourceCompiledDir%-tga
you can also write:
- %gfxexportApp% %resourceDir%\yourfile1.swf -d %resourceCompiledDir%-tga
- %gfxexportApp% %resourceDir%\yourfile2.swf -d %resourceCompiledDir%-tga
- %gfxexportApp% %resourceDir%\yourfile2.swf -d %resourceCompiledDir%-tga
%gfxexportApp% %resourceDir%\yourfile1.swf -d %resourceCompiledDir%-tga %gfxexportApp% %resourceDir%\yourfile2.swf -d %resourceCompiledDir%-tga %gfxexportApp% %resourceDir%\yourfile2.swf -d %resourceCompiledDir%-tga
and all the files are exported in to the data-tga folder. If you need help, please leave a comment.
yEd Graph Editor

For my work I regularly need flowcharts to display data and structures. Today I will introduce you yEd. It is a free graph editor and even I tried several alternatives I stick to it. I use it mostly for custom diagrams like the display of pages and button structures. Usually I try not to make complex graphs because it is a pain for the most people to create the” big picture” from a graph. If others don’t get the main idea immediately, you failed. So i cut them in smaller areas and make them as simple as possible.
A nice feature of yEd is the automatic layout structure. You can select conected objects and choose a layout format the rest is doing yEd by its own. It is shown in the introduction video beneath. It is a nice software available for Windows, Unix/Linux and Mac OS.
Download link | Application Features
Baggage WIP Icons
I am currently working on “BAGGAGE” an icon-theme for a client. It is produced for a 28x28px resolution. After finishing up, I will maybe release a free version of it. Currently it consists of 32 icons, perfect for shops.
Adobe Air and Save XML in a local File
In my earlier post I talked about loading local or online XML data. But how about saving. Since it is nice to save settings for an App. Here is my solution:
- import flash.filesystem.File;
- import flash.filesystem.FileStream;
- import flash.filesystem.FileMode;
- import flash.events.Event;
- /* Determine Path of Loaded and Saved File */
- var appDirectory:File = File.applicationStorageDirectory
- var newFileStream:FileStream = new FileStream();
- var fileString:String = appDirectory.nativePath;
- var appFile:File = File.documentsDirectory;
- appFile = appFile.resolvePath(fileString+"\data.xml");
import flash.filesystem.File; import flash.filesystem.FileStream; import flash.filesystem.FileMode; import flash.events.Event; /* Determine Path of Loaded and Saved File */ var appDirectory:File = File.applicationStorageDirectory var newFileStream:FileStream = new FileStream(); var fileString:String = appDirectory.nativePath; var appFile:File = File.documentsDirectory; appFile = appFile.resolvePath(fileString+"\data.xml");
This code uses a local file called data.xml in the applicationStorageDirectory.
In Windows it is stored here: //C:Users{username}AppDataRoaming{ProjectName}Local Store
- /* LOAD XML */
- var xmlString:URLRequest = new URLRequest(fileString+"\data.xml");
- var xmlLoader:URLLoader = new URLLoader(xmlString);
- xmlLoader.addEventListener("complete", init);
- var defaultXML:XMLDocument = new XMLDocument();
- /* INIT DATA */
- function init(event:Event):void {
- var xml:XML = XML(xmlLoader.data); // Loads the XML data in to the variable "xml"
- }
- /* Save the modified data to the xml file. */
- function saveData(e:Event):void
- {
- newFileStream.openAsync (appFile, FileMode.WRITE);
- var xml:XML = XML(xmlLoader.data);
- xml.newElement = ; // Here you can add a new element in to the XML list
- newFileStream.writeUTFBytes(xml);
- newFileStream.close ();
- }
/* LOAD XML */
var xmlString:URLRequest = new URLRequest(fileString+"\data.xml");
var xmlLoader:URLLoader = new URLLoader(xmlString);
xmlLoader.addEventListener("complete", init);
var defaultXML:XMLDocument = new XMLDocument();
/* INIT DATA */
function init(event:Event):void {
var xml:XML = XML(xmlLoader.data); // Loads the XML data in to the variable "xml"
}
/* Save the modified data to the xml file. */
function saveData(e:Event):void
{
newFileStream.openAsync (appFile, FileMode.WRITE);
var xml:XML = XML(xmlLoader.data);
xml.newElement = ; // Here you can add a new element in to the XML list
newFileStream.writeUTFBytes(xml);
newFileStream.close ();
}If you have questions or a better solution. let me know.
Load XML Files with Adobe Air
I am currently working on an Air2 application and had also work with XML. Last time I had the honor to fight with XML files I was using ActionScript 2 and Flash, so I was happy to switch to ActionScript 3. But like always, there is a small problem. Air2 handles XML a little bit different than Flash. So if you want to load a XML file you have the choice between a local or an online file. And here is the way to handle it:
- //Load LOCAL XML File:
- var XMLfile:File = File.applicationDirectory.resolvePath("XMLfile.xml");
- var myXMLLoader:URLLoader = new URLLoader(new URLRequest(XMLfile.url));
- myXMLLoader.addEventListener(Event.COMPLETE, xmlLoaded);
//Load LOCAL XML File:
var XMLfile:File = File.applicationDirectory.resolvePath("XMLfile.xml");
var myXMLLoader:URLLoader = new URLLoader(new URLRequest(XMLfile.url));
myXMLLoader.addEventListener(Event.COMPLETE, xmlLoaded);On a local file, it is important to include this file also in the project. This is posible by opening the project settings and add the xml file at “list of included files“.
- //Load Online XML File:
- var XMLURL:String = "http://domain.com/XMLfile.xml";
- var NewXML:URLRequest = new URLRequest(XMLURL);
- var myXMLLoader:URLLoader = new URLLoader(NewXML);
- myXMLLoader.addEventListener("complete", xmlLoaded);
//Load Online XML File:
var XMLURL:String = "http://domain.com/XMLfile.xml";
var NewXML:URLRequest = new URLRequest(XMLURL);
var myXMLLoader:URLLoader = new URLLoader(NewXML);
myXMLLoader.addEventListener("complete", xmlLoaded);You have questions?Ask them
Further Reading: ActionScript 3 XML Basics and Create Your Own Adobe AIR Application with Flash