Aug 11
We are currently working on a large project requiring hundreds of Flash assets. On of the requirements is to be able to detect the end of an animation; in Flash 8, you use _currentFrame == _totalFrames. This naturally has changed in AS3 to currentFrame == totalFrames. When using the AS3 notation (inside a Flex app) to examine the Flash 8/AS 2 file, both values come back null.
We discovered that some of them were published for Flash 8, and others for Flash 9. Problem....
ColdFusion to the rescue.
Rupesh Kumar, one of the Adobe engineers, happened to post about a month ago a snippet of Java code that extracted metadata from a SWF. Combining this w/CF yielded the following script, which I was able to pull directly into Excel.
<cfset dir = "D:/workspace/eclipse3.3/farcry_demo/www/courses/assets/VangentAssets/" />
<cfset filter = "*.swf" />
<cfdirectory name="qDir" action="list" directory="#dir#" filter="#filter#" recurse="true" />
<table>
<tr>
<th>File</th>
<th>Is Compressed</th>
<th>Frame Count</th>
<th>Frame rate</th>
<th>Version</th>
<th>Height</th>
<th>Width</th>
</tr>
<cfoutput query="qDir">
<cfset filePath = qDir.directory & "\" & qDir.Name />
<cfset filePath = replace(filePath, "\", "/", "all") />
<cfscript>
fis = createObject("java", "java.io.FileInputStream").init( "#qDir.directory#\#qDir.Name#" ) ; // Create the FileInputStream
decoder = createObject("java", "macromedia.swf.TagDecoder").init(fis); // create TagDecoder
header = decoder.decodeHeader(); // Decode the header.
fis.close();
rect = header.size;
</cfscript>
<tr>
<td>#qDir.directory#\#qDir.Name#</td>
<td>#header.compressed#</td>
<td>#header.framecount#</td>
<td>#header.rate#</td>
<td>#header.version#</td>
<td>#rect.getHeight()#</td>
<td>#rect.getWidth()#</td>
</tr>
</cfoutput>
</table>
<cfsetting showdebugoutput="false" />
May 15, 2009 at 4:23 AM I still think PHP has a major role to play in the future, with PHP5 object oriented and great features like SimpleXML - http://file.sh/XML+torrent.html. IMHO I see PHP scripts for frontend apps and RoR apps for all the backend stuff, and that’s what I’am actually trying to do at work.