Read SWF height and width with Coldfusion

This is a handy little utility I ran across a while back. It allows you to easily read the width and height properties from an SWF using a Coldfusion component. Thanks to Doug Hughes for creating this.

Here's a sample of the Coldfusion code to use the FlashInspetor component.

<cftry>
	<cfset localFile = ExpandPath( "../samples/rectangle.swf")>
	<cfset flashInspector = CreateObject('component', 'components.FlashInspector').init(localFile)>
	
	<!--- get the flash movie's width and height --->
	<cfset width = flashInspector.getMaxX() />
	<cfset height = flashInspector.getMaxY() />
	<cfoutput>#localFile# <br/><b>width:</b> #width#, <b>height:</b> #height#</cfoutput>
	<cfcatch>
		<cfdump var="#cfCatch#"/>
	</cfcatch>
</cftry>
Click here to see the FlashInspector reading some swfs.

Download the FlashInspector.CFC.

4 Comments:

  1. Pepe

    Can this use with AS3 swf files?

  2. derrick

    Yes it does work with AS3 swf files. I have tested with numerous swfs generated from Flex Builder and they all worked fine.

  3. hayatinrengi

    thanks for the code

  4. umer

    can you please give me a code how to get swf metadata in AS3?


Leave a comment

Name: (required)

Email: (required)

URL:

Captcha test: (required)
Comments: (required)