Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Flash ExternalInterface Does Nothing

May 29

I recently helped another developer who was trying to integrate JavaScript with Flash. I recommended using ExternalInterface and pointed him to a couple of links. He emailed me a few hours later saying he had everything linked in, but couldn’t get the example to work correctly. After troubleshooting the problem I realized the allowScriptAccess parameter was set to sameDomain. This won’t work when accessing the page from the local file system, but only when accessed from a webserver (ie http://localhost/external.htm). To get this working the allowScriptAccess parameter needs to be changed to always. This seems trivial, but after an hour’s worth of investigation I stumbled across the answer.

Read More

Activating Flash Programmatically – Getting Around the Eolas Patent

Apr 30

After a recent Windows update you may have noticed that all Flash content (and any ActiveX control) displays a new message that says:

“Click to activate and use this control”

This only applies to Internet Explorer and is a result of a patent filed by Eolas, Inc. While I’m not interested in discussing whether or not I agree with this patent I’m glad to know that there’s a workaround. The workaround enables Flash content to be automatically accessible without having to click it first. I’ve found it rather annoying to see the dotted outline around Flash content and actually having to click to enable it, which I feel lessens the user experience.

Luckily Microsoft has released an article that discusses how developers can get around this programmatically. That means users will be able to interact with Flash content as they did prior to the update. The key is whether or not the developer or webmaster takes the necessary steps to enable this on their sites.

The fix is rather simple and basically consists of pulling your object/embed code out the document and writing it dynamically using JavaScript. For example, let’s say you have the following Flash content in your page:

[object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="" width="746" height="200" id="homepage_globe" align="middle" wmode="opaque"][param name="allowScriptAccess" value="sameDomain" /][param name="menu" value="false" /][param name="wmode" value="opaque" /][param name="movie" value="homepage_globe.swf" /][param name="quality" value="high" /][param name="bgcolor" value="#ffffff" /][/object]

All you need to do is replace this with the following code:

[script xsrc="my_flash.js" mce_src="my_flash.js" language="javascript"][/script]

and within the JavaScript include you’ll dynamically write the content to the page:

document.write(‘[object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="" width="746" height="200" id="homepage_globe" align="middle" wmode="opaque"][param name="allowScriptAccess" value="sameDomain" /][param name="menu" value="false" /][param name="wmode" value="opaque" /][param name="movie" value="homepage_globe.swf" /][param name="quality" value="high" /][param name="bgcolor" value="#ffffff" /][/object]‘);

After implementing this method your Flash content should automatically be activated and your users will never know the Eolas patent ever existed! Here’s a before and after shot:

Read More

FFmpeg and FLV Metadata

Apr 26

I received an interesting comment today that I wanted to respond to.  A reader was asking if there’s support for metadata (mainly to retrieve width and height) within the flv format and if it’s generated by FFmpeg.  In a previous post I talked about using Ruby on Rails to call a FFmpeg process to encode an uploaded video.  Newer versions of the flv format support metadata, while FFmpeg encodes an older format (v1.0 I believe) that doesn’t support it.  Click here for more information on flv metadata.

Here are a couple of options to consider when retrieving the width and height of the uploaded video.  My first suggestion would be to stream the output of the FFmpeg command to a text file and then try to read the dimensions from there.  You’ll see a line in the output that looks something like:

Stream #0.0: Video: dvvideo, yuv411p, 720×480, 29.97 fps

The second option would be to capture a frame from the video and use a server-side script to grab the dimensions of the image.  This may not be the most elegant approach, but I’m pretty sure it would work and you could grab the first frame of video extremely fast.  It would be pretty seamless from an end-user’s perspective.  If I get some time I’ll play around with a couple of approaches and post them here.  If you happen to come up with a solution I would love to hear about it.

Read More

Talking Monkeys – Something Ajax Can’t Do

Mar 28

My dear friend Auburn sent my one of the funniest links I’ve received in a long time. CareerBuilder has implemented a personalized monkey email that allows you to type a message or even use your microphone to record one. Using text-to-speech technology the monkey can then dictate what you typed. The monkey’s lips move rather accurately to what you’ve typed, unlike the old kung-fu movies. You can check it out here.

Auburn was taunting me of our recent trip to Miami, but don’t always believe what a monkey tells you. You can check out an image of the monkey making fun of me below.

Stupid monkey. At any rate, I’d like to mention the technology used to implement this is Adobe’s Flash and Oddcast’s text to speech engine. I know Ajax has been receiving a ton of buzz lately, but this is one thing that Ajax will never be able to touch. Flash truly shines when it comes to highly interactive multimedia that attracts eyeballs. This is not an Flash vs. Ajax post since each technology serves a purpose for a given task. As a Flash advocate it’s always exciting to see these type of ad campaigns crop up.

Read More

Using Flash 8 ExternalInterface for JavaScript Interaction

Jan 30

If you’ve done any Flash/JavaScript interaction then I’m sure you’re well aware of the different approaches you can take.  There’s getURL, fscommand, and the JavaScript Integration Kit.  While I’ve tried all three my new favorite is Flash 8′s ExternalInterface class.  This is by far the cleanest way to do Flash/JavaScript integration.

While this article goes into good detail of how to communicate in both directions, there’s one MAJOR piece missing.  I spent a good deal of time trying to debug my code thinking there was something wrong, but it turns out one of my object/embed parameters was incorrect.  Be sure to set the allowScriptAccess parameter to “always” because it’s set to “sameDomain” by default. I struggled with this in both Safari and Firefox.  After changing this parameter my code ran perfectly.

Read More

ColdFusion MX 7 Reporting Using CFDOCUMENT

Feb 10

It’s late but I couldn’t resist blogging about ColdFusion MX 7, which was finally released two days ago. First off, ColdFusion has come a LONG way since the 4.0 days. That’s when I fell in love with the technology and never looked back. You see I work in a shop of hardcore Java developers, the best in the business and I’m sure they think I’m crazy when I start talking about ColdFusion. I’m sure you’ve had the conversation as well. If you ask any serious Java developer they’ll most likely laugh at CF.

My point is not that CF is better than Java because it runs on a Java engine and CFML compiles down to Java bytecode. Anyway, I would like to stress how Macromedia has done an amazing job with the latest version allowing developers to generate reports with the greatest of ease.

So I wanted to take a quick look at one piece of the reporting functionality in CFMX 7. I want to walk you through the steps of creating a static PDF using HTML wrapped up in the CFDOCUMENT tag. So your general CFML will look like the following:

This simple code will generate the following PDF:

Note that I’m using the free developer edition which is stamped on all the reports. I’m not sure to what extent the reporting engine supports HTML as well as CSS. I will be doing some more experiments and post my results here. I can confidently say that you won’t find an easier way to generate reports with any other technology. The crazy thing is that I haven’t even started talking about the CF report builder which is a WYSIWYG tool for creating report templates. More on that later!

Read More