<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>atc</title>
	<atom:link href="http://addictedtocreation.com/feed" rel="self" type="application/rss+xml" />
	<link>http://addictedtocreation.com</link>
	<description>addicted to creation</description>
	<lastBuildDate>Wed, 16 May 2012 13:43:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>UDK Redesign</title>
		<link>http://addictedtocreation.com/journal/redesign-projekt-of-the-udk</link>
		<comments>http://addictedtocreation.com/journal/redesign-projekt-of-the-udk#comments</comments>
		<pubDate>Fri, 13 Apr 2012 08:49:53 +0000</pubDate>
		<dc:creator>Konrad</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[random work]]></category>

		<guid isPermaLink="false">http://addictedtocreation.com/?p=534</guid>
		<description><![CDATA[For a couple of months now, I worked with the Unreal Development Kit (UDK). It is a game simulation engine and a really nice piece of software.  The UDK has grown over the last several years continuously in functionality but it  never was redesigned. Over the last weekend i sat down and redesigned the main screen. [...]]]></description>
			<content:encoded><![CDATA[<p>For a couple of months now, I worked with the Unreal Development Kit (UDK). It is a game simulation engine and a really nice piece of software.  The UDK has grown over the last several years continuously in functionality but it  never was redesigned. Over the last weekend i sat down and redesigned the main screen. It was challenging to redesign the visuals but being consistent with a certain workflow and logic that users are familiar with.</p>
<p>you can see the final result here:</p>
<p>Portfolio: <a title="Redesigning the Unreal Development Kit" href="http://addictedtocreation.com/portfolio/unreal-development-kit-redesign">Unreal Development Kit &#8211; Redesign</a></p>
]]></content:encoded>
			<wfw:commentRss>http://addictedtocreation.com/journal/redesign-projekt-of-the-udk/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scaleform batch Export</title>
		<link>http://addictedtocreation.com/journal/snippets-and-help/scaleform-batch-export</link>
		<comments>http://addictedtocreation.com/journal/snippets-and-help/scaleform-batch-export#comments</comments>
		<pubDate>Thu, 09 Feb 2012 10:07:51 +0000</pubDate>
		<dc:creator>Konrad</dc:creator>
				<category><![CDATA[Snippets and Help]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[Scaleform]]></category>

		<guid isPermaLink="false">http://addictedtocreation.com/?p=505</guid>
		<description><![CDATA[I am working 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 into a workflow and you have to convert [...]]]></description>
			<content:encoded><![CDATA[<p>I am working 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 into 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 find the time until now.</p>
<p>But there are always several ways. I wrote a little batch file that creates a subfolder and exports all the necessary .gfx files and images into it. The only problem is, you have to set it up the first time you need it:</p>
<p><em> 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, they had some solutions that where nicer than mine, so i have updated my script:</em></p>
<p>&nbsp;</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="bash"><ol><li class="li1"><div class="de1"><span class="sy0">@</span><span class="kw3">echo</span> off</div></li>
<li class="li2"><div class="de2">cls</div></li>
<li class="li1"><div class="de1">echo.</div></li>
<li class="li2"><div class="de2">rem ===========================================================================================</div></li>
<li class="li1"><div class="de1">rem This <span class="kw2">file</span> originated from the scaleform example projects and was edited by konrad koch</div></li>
<li class="li2"><div class="de2">rem addictedtocreation.com If you have remarks or an idea to optimize it, <span class="kw3">let</span> me know</div></li>
<li class="li1"><div class="de1">rem ===========================================================================================</div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw1">set</span> <span class="re2">resourceDir</span>=.</div></li>
<li class="li2"><div class="de2"><span class="kw1">if</span> not <span class="st0">&quot;%1&quot;</span> == <span class="st0">&quot;&quot;</span> <span class="br0">&#40;</span><span class="kw1">set</span> <span class="re2">resourceDir</span>=<span class="sy0">%</span>1<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="kw3">echo</span> resourceDir<span class="br0">&#40;</span><span class="st0">&quot;%resourceDir%&quot;</span><span class="br0">&#41;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw1">set</span> <span class="re2">resourceFile</span>=yourSWFfilename.swf</div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1">rem <span class="co0">###########################################################################################</span></div></li>
<li class="li2"><div class="de2">rem ===========================================================================================</div></li>
<li class="li1"><div class="de1">rem IMPORTANT: CHANGE THE NAME OF THE SUBFILE YOU WANT TO HAVE YOUR EXPORT<span class="sy0">!</span></div></li>
<li class="li2"><div class="de2">rem CURRENTLY IT IS <span class="st0">&quot;data&quot;</span>. The folder will be deleted each <span class="kw1">time</span> you runn the script.</div></li>
<li class="li1"><div class="de1">rem So you have always the newest files</div></li>
<li class="li2"><div class="de2">rem ===========================================================================================</div></li>
<li class="li1"><div class="de1">rem <span class="co0">###########################################################################################</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw1">set</span> <span class="re2">resourceCompiledDir</span>=<span class="sy0">%</span>resourceDir<span class="sy0">%</span>\data</div></li>
<li class="li2"><div class="de2"><span class="kw3">echo</span> Deleting folder <span class="st0">&quot;%resourceCompiledDir%&quot;</span></div></li>
<li class="li1"><div class="de1"><span class="kw1">if</span> exist <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span> <span class="br0">&#40;</span>rd <span class="sy0">/</span>s <span class="sy0">/</span>q <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span><span class="br0">&#41;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1">rem <span class="co0">###########################################################################################</span></div></li>
<li class="li2"><div class="de2">rem ===========================================================================================</div></li>
<li class="li1"><div class="de1">rem IMPORTANT: CHANGE THE PATH TO YOUR GFXEXPORT.EXE PATH<span class="sy0">!</span></div></li>
<li class="li2"><div class="de2">rem ===========================================================================================</div></li>
<li class="li1"><div class="de1">rem <span class="co0">###########################################################################################</span></div></li>
<li class="li2"><div class="de2"><span class="kw1">set</span> <span class="re2">gfxexportApp</span>=<span class="st0">&quot;C:\Program Files (x86)\Scaleform\GFx SDK 4.0\Bin\gfxexport.exe&quot;</span></div></li>
<li class="li1"><div class="de1"><span class="kw3">echo</span> GFxExport<span class="br0">&#40;</span><span class="st0">&quot;%gfxexportApp%&quot;</span><span class="br0">&#41;</span> </div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1">rem <span class="co0">###########################################################################################</span></div></li>
<li class="li2"><div class="de2">rem PRESELECTION:</div></li>
<li class="li1"><div class="de1">rem <span class="co0">###########################################################################################</span></div></li>
<li class="li2"><div class="de2">echo.</div></li>
<li class="li1"><div class="de1"><span class="kw3">echo</span> How <span class="kw1">do</span> you want to <span class="kw3">export</span> the files?</div></li>
<li class="li2"><div class="de2"><span class="kw3">echo</span> <span class="nu0">1</span>. TGA <span class="kw3">export</span>:</div></li>
<li class="li1"><div class="de1"><span class="kw3">echo</span> <span class="nu0">2</span>. DDS <span class="kw3">export</span> with uncompressed DXT1:</div></li>
<li class="li2"><div class="de2"><span class="kw3">echo</span> <span class="nu0">3</span>. DDS <span class="kw3">export</span> with uncompressed DXT1 and compressed DXT5 with alpha:</div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2">:selection</div></li>
<li class="li1"><div class="de1"><span class="kw1">set</span> <span class="sy0">/</span>P <span class="re2">wahl</span>=please <span class="kw1">select</span>:</div></li>
<li class="li2"><div class="de2"><span class="kw1">if</span> <span class="sy0">/</span>i <span class="st0">&quot;%wahl%&quot;</span>==<span class="st0">&quot;1&quot;</span> goto:tga</div></li>
<li class="li1"><div class="de1"><span class="kw1">if</span> <span class="sy0">/</span>i <span class="st0">&quot;%wahl%&quot;</span>==<span class="st0">&quot;2&quot;</span> goto:dxt1</div></li>
<li class="li2"><div class="de2"><span class="kw1">if</span> <span class="sy0">/</span>i <span class="st0">&quot;%wahl%&quot;</span>==<span class="st0">&quot;3&quot;</span> goto:dxt5</div></li>
<li class="li1"><div class="de1"><span class="kw3">echo</span> Wrong selection<span class="sy0">!</span></div></li>
<li class="li2"><div class="de2">goto:selection</div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2">:tga</div></li>
<li class="li1"><div class="de1">echo.</div></li>
<li class="li2"><div class="de2"><span class="kw3">echo</span> Exporting files TGA...</div></li>
<li class="li1"><div class="de1"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="sy0">%</span>resourceDir<span class="sy0">%</span>\<span class="sy0">%</span>resourceFile<span class="sy0">%</span> <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-tga</div></li>
<li class="li2"><div class="de2">pause</div></li>
<li class="li1"><div class="de1">goto:eof</div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1">:dxt1</div></li>
<li class="li2"><div class="de2">echo.</div></li>
<li class="li1"><div class="de1"><span class="kw3">echo</span> Exporting files DXT1...</div></li>
<li class="li2"><div class="de2"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="re5">-i</span> DDS <span class="re5">-d0</span> <span class="sy0">%</span>resourceDir<span class="sy0">%</span>\<span class="sy0">%</span>resourceFile<span class="sy0">%</span> <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-dxt1</div></li>
<li class="li1"><div class="de1">pause</div></li>
<li class="li2"><div class="de2">goto:eof</div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2">:dxt5</div></li>
<li class="li1"><div class="de1">echo.</div></li>
<li class="li2"><div class="de2"><span class="kw3">echo</span> Exporting files DXT1 and DXT5...</div></li>
<li class="li1"><div class="de1"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="re5">-i</span> DDS <span class="re5">-d5</span> &nbsp;<span class="sy0">%</span>resourceDir<span class="sy0">%</span>\<span class="sy0">%</span>resourceFile<span class="sy0">%</span> <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-dxt5</div></li>
<li class="li2"><div class="de2">pause</div></li>
<li class="li1"><div class="de1">goto:eof</div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">@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</pre></div></div>

<p>How to use it:</p>
<p>Copy the file in to a textfile, change attributes of the .swf filename in side of the textfile and the path of your gfxexporter. Then change the file name from <em>whatever.txt</em> to <em>whatever.batch</em>. Save and run the batch file.<br />
Select which preset you want and the project will convert your files in to a <em>data-tga</em>, <em>data-dxt1</em> or <em>data-dxt5</em> folder.</p>
<p>If you have multiple files you can add them on the bottom. SO instead of:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="bash"><ol><li class="li1"><div class="de1"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="sy0">%</span>resourceDir<span class="sy0">%</span>\<span class="sy0">%</span>resourceFile<span class="sy0">%</span> <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-tga</div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">%gfxexportApp% %resourceDir%\%resourceFile% -d %resourceCompiledDir%-tga</pre></div></div>

<p>you can also write:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="bash"><ol><li class="li1"><div class="de1"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="sy0">%</span>resourceDir<span class="sy0">%</span>\yourfile1.swf <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-tga</div></li>
<li class="li2"><div class="de2"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="sy0">%</span>resourceDir<span class="sy0">%</span>\yourfile2.swf <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-tga</div></li>
<li class="li1"><div class="de1"><span class="sy0">%</span>gfxexportApp<span class="sy0">%</span> <span class="sy0">%</span>resourceDir<span class="sy0">%</span>\yourfile2.swf <span class="re5">-d</span> <span class="sy0">%</span>resourceCompiledDir<span class="sy0">%</span>-tga</div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">%gfxexportApp% %resourceDir%\yourfile1.swf -d %resourceCompiledDir%-tga
%gfxexportApp% %resourceDir%\yourfile2.swf -d %resourceCompiledDir%-tga
%gfxexportApp% %resourceDir%\yourfile2.swf -d %resourceCompiledDir%-tga</pre></div></div>

<p>and all the files are exported in to the data-tga folder. If you need help, please leave a comment.</p>
<p><em>UPDATE 2:</em> If you use a global font or asset library. You have to export them <strong>first</strong>. Then the other files that reference those libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://addictedtocreation.com/journal/snippets-and-help/scaleform-batch-export/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>yEd Graph Editor</title>
		<link>http://addictedtocreation.com/journal/tools/yed-graph-editor</link>
		<comments>http://addictedtocreation.com/journal/tools/yed-graph-editor#comments</comments>
		<pubDate>Tue, 17 Jan 2012 09:05:36 +0000</pubDate>
		<dc:creator>Konrad</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Graph Editor]]></category>

		<guid isPermaLink="false">http://addictedtocreation.com/?p=474</guid>
		<description><![CDATA[For my work I regularly need flowcharts to display data and structures. Today I will introduce you to yEd. It is a free graph editor even though 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 [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" src="http://gameui.de/wp-content/uploads/2011/07/The-witcher-2-Asassins-of-Kings-Flowchart-620x440.png" alt="" width="522" height="370" /></p>
<p>For my work I regularly need flowcharts to display data and structures. Today I will introduce you to yEd. It is a free graph editor even though 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 most people to create the&#8221; big picture&#8221; from a graph. If others don&#8217;t get the main idea immediately, you failed. So i cut them in smaller areas and made them as simple as possible.</p>
<p>A nice feature of yEd is the automatic layout structure. You can select connected objects and choose a layout format, yEd is doing the rest for you. An introduction video to yED is shown below. It is a nice software, available for for Windows, Unix/Linux and Mac OS.</p>
<p><a href="http://www.yworks.com/en/products_yed_download.html ">Download link</a>  |  <a href="http://www.yworks.com/en/products_yed_applicationfeatures.html">Application Features</a></p>
<p><iframe src="http://www.youtube.com/embed/OmSTwKw7dX4" frameborder="0" width="640" height="355"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://addictedtocreation.com/journal/tools/yed-graph-editor/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Baggage WIP Icons</title>
		<link>http://addictedtocreation.com/journal/random-work/baggage-wip-icons</link>
		<comments>http://addictedtocreation.com/journal/random-work/baggage-wip-icons#comments</comments>
		<pubDate>Fri, 23 Dec 2011 10:02:07 +0000</pubDate>
		<dc:creator>Konrad</dc:creator>
				<category><![CDATA[random work]]></category>
		<category><![CDATA[customer]]></category>
		<category><![CDATA[Icons]]></category>
		<category><![CDATA[pixelperfect]]></category>

		<guid isPermaLink="false">http://addictedtocreation.com/?p=450</guid>
		<description><![CDATA[I am currently working on &#8220;BAGGAGE&#8221; 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.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-451" title="baggage-icontheme" src="http://addictedtocreation.com/wp-content/uploads/2011/12/baggage-icontheme.png" alt="Baggage Icontheme" width="205" height="131" />I am currently working on &#8220;BAGGAGE&#8221; an icon-theme for a client. It is produced for a  28x28px resolution. After finishing up, I will <em>maybe</em> release a free version of it. Currently it consists of 32 icons, perfect for shops.</p>
]]></content:encoded>
			<wfw:commentRss>http://addictedtocreation.com/journal/random-work/baggage-wip-icons/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Air and Save XML in a local File</title>
		<link>http://addictedtocreation.com/journal/snippets-and-help/adobe-air-and-save-xml-in-a-local-file</link>
		<comments>http://addictedtocreation.com/journal/snippets-and-help/adobe-air-and-save-xml-in-a-local-file#comments</comments>
		<pubDate>Tue, 13 Dec 2011 09:25:15 +0000</pubDate>
		<dc:creator>Konrad</dc:creator>
				<category><![CDATA[Snippets and Help]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Datastream]]></category>
		<category><![CDATA[FileStream]]></category>
		<category><![CDATA[Load]]></category>
		<category><![CDATA[Save]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://localhost/atc/?p=42</guid>
		<description><![CDATA[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; &#160; /* Determine Path of Loaded and Saved File */ var appDirectory:File = File.applicationStorageDirectory var newFileStream:FileStream [...]]]></description>
			<content:encoded><![CDATA[<p>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:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="actionscript3"><ol><li class="li1"><div class="de1"><span class="kw1">import</span> flash<span class="sy0">.</span>filesystem<span class="sy0">.</span>File<span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="kw1">import</span> flash<span class="sy0">.</span>filesystem<span class="sy0">.</span>FileStream<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw1">import</span> flash<span class="sy0">.</span>filesystem<span class="sy0">.</span>FileMode<span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="kw1">import</span> <span class="kw6">flash.events</span><span class="sy0">.</span><span class="kw5">Event</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2"><span class="co2">/* Determine Path of Loaded and Saved File */</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> appDirectory<span class="sy0">:</span>File = File<span class="sy0">.</span>applicationStorageDirectory</div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> newFileStream<span class="sy0">:</span>FileStream = <span class="kw1">new</span> FileStream<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> fileString<span class="sy0">:</span><span class="kw5">String</span> = appDirectory<span class="sy0">.</span>nativePath<span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> appFile<span class="sy0">:</span>File = File<span class="sy0">.</span>documentsDirectory<span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">appFile = appFile<span class="sy0">.</span>resolvePath<span class="br0">&#40;</span>fileString<span class="sy0">+</span><span class="st0">&quot;<span class="es0">\d</span>ata.xml&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">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");</pre></div></div>

<p>This code uses a local file called <em>data.xml</em> in the <em>applicationStorageDirectory</em>.<br />
In Windows it is stored here:<em> //C:Users{username}AppDataRoaming{ProjectName}Local Store</em></p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="actionscript3"><ol start="12"><li class="li1"><div class="de1"><span class="coMULTI">/* LOAD XML */</span></div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> xmlString<span class="sy0">:</span><span class="kw5">URLRequest</span> = <span class="kw1">new</span> <span class="kw5">URLRequest</span><span class="br0">&#40;</span>fileString<span class="sy0">+</span><span class="st0">&quot;<span class="es0">\d</span>ata.xml&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> xmlLoader<span class="sy0">:</span><span class="kw5">URLLoader</span> = <span class="kw1">new</span> <span class="kw5">URLLoader</span><span class="br0">&#40;</span>xmlString<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">xmlLoader<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><span class="st0">&quot;complete&quot;</span><span class="sy0">,</span> <span class="kw7">init</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> defaultXML<span class="sy0">:</span><span class="kw5">XMLDocument</span> = <span class="kw1">new</span> <span class="kw5">XMLDocument</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="co2">/* INIT DATA */</span></div></li>
<li class="li2"><div class="de2"><span class="kw3">function</span> <span class="kw7">init</span><span class="br0">&#40;</span>event<span class="sy0">:</span><span class="kw5">Event</span><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> xml<span class="sy0">:</span><span class="kw5">XML</span> = <span class="kw5">XML</span><span class="br0">&#40;</span>xmlLoader<span class="sy0">.</span><span class="kw7">data</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// Loads the XML data in to the variable &quot;xml&quot;</span></div></li>
<li class="li2"><div class="de2"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2"><span class="co2">/* Save the modified data to the xml file. */</span></div></li>
<li class="li1"><div class="de1"><span class="kw3">function</span> saveData<span class="br0">&#40;</span>e<span class="sy0">:</span><span class="kw5">Event</span><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span></div></li>
<li class="li2"><div class="de2"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">newFileStream<span class="sy0">.</span>openAsync <span class="br0">&#40;</span>appFile<span class="sy0">,</span> FileMode<span class="sy0">.</span>WRITE<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> xml<span class="sy0">:</span><span class="kw5">XML</span> = <span class="kw5">XML</span><span class="br0">&#40;</span>xmlLoader<span class="sy0">.</span><span class="kw7">data</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">xml<span class="sy0">.</span>newElement = <span class="sy0">;</span> <span class="co1">// Here you can add a new element in to the XML list</span></div></li>
<li class="li2"><div class="de2">newFileStream<span class="sy0">.</span><span class="kw7">writeUTFBytes</span><span class="br0">&#40;</span>xml<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">newFileStream<span class="sy0">.</span><span class="kw7">close</span> <span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="br0">&#125;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">/* 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 ();
}</pre></div></div>

<p>If you have questions or a better solution. let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://addictedtocreation.com/journal/snippets-and-help/adobe-air-and-save-xml-in-a-local-file/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load XML Files with Adobe Air</title>
		<link>http://addictedtocreation.com/journal/snippets-and-help/adobe-air-and-xml-files</link>
		<comments>http://addictedtocreation.com/journal/snippets-and-help/adobe-air-and-xml-files#comments</comments>
		<pubDate>Sun, 11 Dec 2011 19:04:45 +0000</pubDate>
		<dc:creator>Konrad</dc:creator>
				<category><![CDATA[Snippets and Help]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Include XML]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://localhost/atc/?p=41</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="actionscript3"><ol><li class="li1"><div class="de1"><span class="co1">//Load LOCAL XML File:</span></div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> XMLfile<span class="sy0">:</span>File = File<span class="sy0">.</span>applicationDirectory<span class="sy0">.</span>resolvePath<span class="br0">&#40;</span><span class="st0">&quot;XMLfile.xml&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> myXMLLoader<span class="sy0">:</span><span class="kw5">URLLoader</span> = <span class="kw1">new</span> <span class="kw5">URLLoader</span><span class="br0">&#40;</span><span class="kw1">new</span> <span class="kw5">URLRequest</span><span class="br0">&#40;</span>XMLfile<span class="sy0">.</span><span class="kw7">url</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">myXMLLoader<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><span class="kw5">Event</span><span class="sy0">.</span><span class="kw8">COMPLETE</span><span class="sy0">,</span> xmlLoaded<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">//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);</pre></div></div>

<p>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 &#8220;<strong>list of included files</strong>&#8220;.</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="actionscript3"><ol><li class="li1"><div class="de1"><span class="co1">//Load Online XML File:</span></div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> XMLURL<span class="sy0">:</span><span class="kw5">String</span> = <span class="st0">&quot;http://domain.com/XMLfile.xml&quot;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="kw2">var</span> NewXML<span class="sy0">:</span><span class="kw5">URLRequest</span> = <span class="kw1">new</span> <span class="kw5">URLRequest</span><span class="br0">&#40;</span>XMLURL<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="kw2">var</span> myXMLLoader<span class="sy0">:</span><span class="kw5">URLLoader</span> = <span class="kw1">new</span> <span class="kw5">URLLoader</span><span class="br0">&#40;</span>NewXML<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">myXMLLoader<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><span class="st0">&quot;complete&quot;</span><span class="sy0">,</span> xmlLoaded<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">//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);</pre></div></div>

<p>You have questions?Ask them <img src='http://addictedtocreation.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Further Reading: <a href="http://www.gotoandlearn.com/play.php?id=64" title="ActionScript 3 XML Basics" target="_blank">ActionScript 3 XML Basics</a> and <a href="http://active.tutsplus.com/tutorials/air/create-your-own-adobe-air-application-with-flash" title="Create Your Own Adobe AIR Application with Flash" target="_blank">Create Your Own Adobe AIR Application with Flash</a></p>
]]></content:encoded>
			<wfw:commentRss>http://addictedtocreation.com/journal/snippets-and-help/adobe-air-and-xml-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

