<?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>Dirty Motherfucking Blog &#187; aswing</title>
	<atom:link href="http://dirty-motherfucker.org/blog/tag/aswing/feed/" rel="self" type="application/rss+xml" />
	<link>http://dirty-motherfucker.org/blog</link>
	<description>All kinds of shit</description>
	<lastBuildDate>Wed, 04 Jan 2012 15:38:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19620</generator>
		<item>
		<title>Converting SWF animations to video</title>
		<link>http://dirty-motherfucker.org/blog/2008/10/14/converting-swf-animtions-to-video/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/10/14/converting-swf-animtions-to-video/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 09:25:54 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[aswing]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[swfstudio]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=151</guid>
		<description><![CDATA[If you ever tried to convert a SWF animation to a video you know what a pain it can be. Let&#8217;s first look at the solutions at hand: Exporting a movie from Flash Using a SWF to movie converter Screen capture Now let&#8217;s break those down. Exporting a movie from Flash - Doesn&#8217;t play sub-movieclip [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever tried to convert a SWF animation to a video you know what a pain it can be. Let&#8217;s first look at the solutions at hand:</p>
<ul>
<li>Exporting a movie from Flash</li>
<li>Using a SWF to movie converter</li>
<li>Screen capture</li>
</ul>
<p>Now let&#8217;s break those down.</p>
<ul>
<li>Exporting a movie from Flash<br />
- Doesn&#8217;t play sub-movieclip animations</li>
<li>Using a SWF to video converter<br />
- Some have limited encoding support<br />
- Some have really bad encoding quality<br />
- Some have poor playback performance and the result looks shitty<br />
- Some also don&#8217;t play sub-movieclip animations</li>
<li>Screen capture<br />
- Suffers from the same encoding and playback problems as converters</li>
</ul>
<p>So, after trying all of the above on a project at hand i was rather disappointed to see that all the solution i tried were basically shit. The animation at hand had 1024&#215;768 dimensions and only in Flash player 10 it played with reasonable speed. So when i added screen capture into the mix the result looked like crap.</p>
<p>So i rolled my own converter. And the goals were clear:</p>
<ul>
<li>I want to capture every single frame of the animation</li>
<li>I want the highest quality possible</li>
<li>I want to use the vector scaling of flash to achieve my target size to avoid bitmap scaling later on in the process.</li>
</ul>
<p>Now what i ended up with is a converter that just writes out every single frame as PNG, no sound, no direct video. But capturing the sound is extremely easy and so is converting a PNG sequence into a movie.</p>
<p>So here is how it&#8217;s done.<br />
At first i tried to gotoAndStop( ++frame ); in a loop and writing out the frames, but this results in sub-movieclip animations not being played back.<br />
So what you have to do is just play the movie. But you place a listener on it for Event.ENTER_FRAME. If your host application runs at the same frame rate you can also place the listener on the host application (which is what I&#8217;ve done in my reference implementation).</p>
<p>Now in the event listener you just .draw into a BitmapData object, encode it to PNG (using the AsPngEncoder from the AsWing project for example) and then write it to disk.<br />
And this is where you get problems. Cause Flash itself won&#8217;t let you write to disk. I had 2 solutions to that problem. I used SWFStudio to compile a .exe that could write binaries to disk and i wrote one version in AIR.</p>
<p>Feel free to look at both implementations, but keep in mind that they are basically proof-of-concept, look like shit and are almost unuseable.</p>
<p>The SWFStudio version expects the name of the swf as the first command-line parameter (which can&#8217;t include spaces). The second and third parameter are the width and height. The last parameter is the number of frames to write.</p>
<p>The AIR version includes a GUI to set the input movie and output folder.</p>
<p>Have fun!</p>
<p><a href="http://dirty-motherfucker.org/blog/wp-content/uploads/2008/10/swf2videoconverter.zip">SWFStudio Version</a><br />
<a href="http://dirty-motherfucker.org/blog/wp-content/uploads/2008/10/swf2videoconverterair.zip">Adobe AIR Version</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/10/14/converting-swf-animtions-to-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly generating AsDoc</title>
		<link>http://dirty-motherfucker.org/blog/2008/06/17/quickly-generating-asdoc/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/06/17/quickly-generating-asdoc/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 09:44:06 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[aswing]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=109</guid>
		<description><![CDATA[For ease of use i have a small batch file to generate the documentation for my ActionScript projects. It&#8217;s definitely nothing special, but if you struggle with the asdoc syntax and you just want a quick solution, here it is: It also points asdoc to the bin directory of AsWing, where it will find the [...]]]></description>
			<content:encoded><![CDATA[<p>For ease of use i have a small batch file to generate the documentation for my ActionScript projects. It&#8217;s definitely nothing special, but if you struggle with the asdoc syntax and you just want a quick solution, here it is:</p>
<pre class="brush: plain; title: ; notranslate">
@echo off

set asdoc_bin=&quot;E:\projects\flex_sdk_3\bin\asdoc.exe&quot;
set aswing_path=&quot;E:\projects\aswing\trunk\AsWing\bin&quot;

%asdoc_bin% -doc-sources org\dirty_motherfucker\. -main-title &quot;My ActionScript Project&quot; -output &quot;doc&quot; -compiler.library-path %aswing_path%

pause
</pre>
<p>It also points asdoc to the bin directory of AsWing, where it will find the .swc files needed so it can fully understand each part of the sources in my namespace.<br />
If you use several libraries, you will have to supply the library paths as well.</p>
<p>Now, let&#8217;s say you don&#8217;t have every library available as .swc and you also don&#8217;t feel like compiling one. Then you&#8217;d use -compiler.source-path. Here is an example of a project that uses more libraries.</p>
<pre class="brush: plain; title: ; notranslate">
@echo off

set asdoc_bin=&quot;E:\projects\flex_sdk_3\bin\asdoc.exe&quot;
set aswing_path=&quot;E:\projects\aswing\trunk\AsWing\bin&quot;
set aswingkit_path=&quot;E:\projects\AsWingKit\src&quot;
set puremvc_path=&quot;E:\projects\PureMVC\src&quot;
set tweenlite_path=&quot;E:\projects\TweenFilterLiteAS3&quot;

%asdoc_bin% -doc-sources src\org\dirty_motherfucker -main-title &quot;Content Delivery Framework&quot; -output &quot;doc&quot; -compiler.library-path %aswing_path% -compiler.source-path %puremvc_path% %aswingkit_path% %tweenlite_path% src\ -warnings

pause
</pre>
<p>Also, note in this second example that i include src\ in the source paths. I only generate the documentation for the files in my namespace, but those use source file which reside in the same project directory, thus you should include the whole source directory to make sure everything runs smoothly.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/06/17/quickly-generating-asdoc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building an SWC library using the Flex 3 SDK</title>
		<link>http://dirty-motherfucker.org/blog/2008/02/20/building-an-swc-library-using-the-flex-3-sdk/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/02/20/building-an-swc-library-using-the-flex-3-sdk/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 22:18:20 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[aswing]]></category>
		<category><![CDATA[flex sdk]]></category>
		<category><![CDATA[swc]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=25</guid>
		<description><![CDATA[So the other day i was trying to build the AsWing library with the Flex SDK. Sadly, i failed miserably. I didn&#8217;t even know where to start. How do you feed all the files into the compiler? What command line switches to use? So after reading basically every piece of documentation that Adobe has to [...]]]></description>
			<content:encoded><![CDATA[<p>So the other day i was trying to build the AsWing library with the Flex SDK. Sadly, i failed miserably. I didn&#8217;t even know where to start. How do you feed all the files into the compiler? What command line switches to use? So after reading basically every piece of documentation that Adobe has to offer, i finally pieced it together.</p>
<p>And now i can proudly say, that wasn&#8217;t so hard after all, was it?<br />
Alright, enough with the prologue. If you&#8217;re interested in the topic of build an SWC with the SDK you most likely know that you have to feed all the libraries classes into it using a manifest file. But in the case of AsWing, there are like a million files to add (give or take). So i wrote myself a handy script real quick:</p>
<pre class="brush: jscript; title: ; notranslate">var fso = new ActiveXObject( &quot;Scripting.FileSystemObject&quot; );
var manifest = fso.createTextFile( &quot;src\\manifest.xml&quot;, true );

manifest.writeLine( &quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;&quot; );
manifest.writeLine( &quot;&lt;componentPackage&gt;&quot; );

var src = fso.getFolder( &quot;src&quot; );
listFolder( src, manifest, &quot;&quot; );

manifest.writeLine( &quot;&lt;/componentPackage&gt;&quot; );

manifest.close();

function listFolder( source, target, package ) {
	for( var items = new Enumerator( source.SubFolders ); !items.atEnd(); items.moveNext() ) {
		var currentFolder = items.item();
		listFolder( currentFolder, target, package + currentFolder.name + &quot;.&quot; );
	}

	for( var files = new Enumerator( source.files ); !files.atEnd(); files.moveNext() ) {
		var currentFile = files.item();
		if( String( currentFile.name ).match( &quot;\.as$&quot; ) ) {
			var component = String( currentFile.name ).replace( &quot;\.as&quot;, &quot;&quot; );
			target.writeLine( &quot;\t&lt;component id=\&quot;&quot; + component + &quot;\&quot; class=\&quot;&quot; + package + component + &quot;\&quot;/&gt;&quot; );
		}
	}
}</pre>
<p>So, that bad boy will build you the manifest for the given folder. I named this guy configure.js and placed it in the AsWing folder.<br />
Now for slightly easier calling i added a small .bat to go with that. There&#8217;s only one line that matters and it is: <b>wscript.exe configure.js</b></p>
<p>So far so good. Now we&#8217;re only missing the actual building (i&#8217;m hiliting this as JavaScript, but it&#8217;s only a .bat ;P):</p>
<pre class="brush: jscript; title: ; notranslate">
@echo off

set flex_sdk_dir=path_to_flex_sdk

if (%flex_sdk_dir%) == (path_to_flex_sdk) goto sdk_missing
if (%flex_sdk_dir%) == () goto sdk_missing
if not exist %flex_sdk_dir% goto sdk_missing

if not exist src\manifest.xml goto manifest_missing

goto make

:manifest_missing
echo You have to run configure.bat first.
goto end

:sdk_missing
echo You have to set the path to the Flex SDK inside &quot;%0.bat&quot;.
goto end

:make
echo Making...

if not exist bin md bin
set compc=%flex_sdk_dir%\bin\compc.exe
%compc% -source-path src -output bin\AsWing.swc -namespace http://aswing.org src\manifest.xml -include-namespaces http://aswing.org 

:end
echo Done.
</pre>
<p>That should be it ;) I also added these scripts to the AsWing repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/02/20/building-an-swc-library-using-the-flex-3-sdk/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>MessageBox Class for AsWing</title>
		<link>http://dirty-motherfucker.org/blog/2008/02/01/messagebox-class-for-aswing/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/02/01/messagebox-class-for-aswing/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 17:14:25 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[aswing]]></category>
		<category><![CDATA[messagebox]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/2008/02/01/messagebox-class-for-aswing/</guid>
		<description><![CDATA[I lately commited a new class to the AsWing Kit SVN. It enables you to display simple message boxes in AsWing based ActionScript applications. The class was modeled after the Windows API function MessageBox(). The repository can be accessed through http://svn.aswing.org/aswingkit]]></description>
			<content:encoded><![CDATA[<p>I lately commited a new class to the AsWing Kit SVN.</p>
<p>It enables you to display simple message boxes in AsWing based ActionScript applications.<br />
The class was modeled after  the Windows API function MessageBox().</p>
<p><a href="http://dirty-motherfucker.org/blog/wp-content/uploads/2008/02/aswing_messagebox.png" title="AsWing MessageBox"><img src="http://dirty-motherfucker.org/blog/wp-content/uploads/2008/02/aswing_messagebox.thumbnail.png" alt="AsWing MessageBox" /></a></p>
<p>The repository can be accessed through <a href="http://svn.aswing.org/aswingkit" class="linkification-ext" title="Linkification: http://svn.aswing.org/aswingkit">http://svn.aswing.org/aswingkit</a></p>
<pre class="brush: as3; title: ; notranslate">
/**
* Opens the global MessageBox instance with the supplied parameters set.
* When the MessageBox is closed it will call the closeHandler function.
* If the user added a Help button to the box and it is clicked, the helpHandler function will be called. Clicking the help button doesn't close the MessageBox.
* Example: &amp;lt;code&amp;gt;MessageBox.showDialog( null, &quot;An error has occured.&quot;, &quot;Error&quot;, MessageBox.ICON_ERROR | MessageBox.ABORT_RETRY_IGNORE | MessageBox.HELP, function( button:String ):void { trace( button ); } );&amp;lt;/code&amp;gt;
* @param    owner The owner for the JFrame instance. This can be left as null.
* @param    text The text to be displayed in the MessageBox.
* @param    caption The caption of the MessageBox. Default is &quot;Error&quot;.
* @param    type A combination of flags that describe the type of MessageBox.
* This can be a combination of a button flag (plus optional help button), an icon flag and text orientation. Optionally the text can be made selectable.
* The default value is: &amp;lt;code&amp;gt;OK_ONLY | ICON_NONE | TEXT_ORIENTATION_LEFT | STATIC_TEXT&amp;lt;/code&amp;gt;
* @param    closeHandler This function will be called when the MessageBox is closed. It sends one parameter which is one of the button flags.
* Possible flags are: &amp;lt;code&amp;gt;ABORT, CANCEL, CONTINUE, IGNORE, NO, OK, RETRY, TRY_AGAIN, YES&amp;lt;/code&amp;gt;
* @param    helpHandler This function will be called when the user clicks the help button.
*/
public static function showDialog( owner:* = null, text:String = &quot;&quot;, caption:String = &quot;Error&quot;, type:uint = 0, closeHandler:Function = null, helpHandler:Function = null ):void {
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/02/01/messagebox-class-for-aswing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

