Troubleshooting SWF Loading Issues in Chrome - MIME Type Issue With S3

As some of you may already know, I run and maintain a few of my own products, the most popular of which being Scribblar which pushes hundreds of sessions every day.

Recently I started getting reports from users that the main page which hosts the applications' main SWF file was not loading properly, or it would work in one browser but not another. Within the handful of reports I had, Google Chrome appeared to be the browser that posed most of the issues - this seemed odd as Chrome effectively has Flash Player built-in and always auto-updates to the latest release version which is why I recommend it as the preferred browser to anyone who asks.

My first look was towards SWFObject - I figured that maybe something in Chrome had changed and broken the Flash Player detection. A common trap that some developers fall into is to check for specific Flash Player versions, for example only allowing access to Player 11 or below, which then locks users out once Player 11.5 (or similar) is released. But this wasn't the issue here.

After much more digging and more back-and-forth emails with some users I noticed a very odd behaviour when trying to access my SWF directly (without an HTML wrapper) in Chrome. This image shows the request in the Chrome Debugger.
Chrome Debug Output
Notice how the shows as 'canceled', and that the content type is coming up as the generic binary/octet-stream? Clearly this pointed towards Chrome not being able to deal with a wrongly set MIME type correctly, whereas other browser may have handled this is a more flexible way.

[Read Full Article]

Accessing the mx_internal Namespace in Flex

This is a topic that comes up from time to time, and it did so for me on a current project so I thought to quickly sum it up again here.
I was working on a Flex project using an old SDK (4.1) and the OSMF-based Spark VideoPlayer component contained within. I had to use this particular player since the customer needed to target Flash Player 10.0 or above.

I'm unsure which version of OSMF this Flex SDK contained, but what I could see was there seemed to be no obvious way to set the bufferTime on the MediaPlayer instance that's contained within the VideoDisplay instance that's contained within the VideoPlayer due to the fact that the MediaPlayer instance was namespaced to mx_internal

view plain print about
1mx_internal var videoPlayer:MediaPlayer;

What does this namespace mean? It basically is Adobe's way of saying: "Watch out, this stuff right here is likely to change in a future version (of OSMF in this case) and if you mess with it then it may break in the future."

Well in my case it was worth the risk :-) and here's how you'd access the bufferTime property and use the mx_internal namespace.
At the end of all your import statement add this:

view plain print about
1import mx.core.mx_internal;
2use namespace mx_internal;

Then somewhere else in your code you can do this (where player is my instance of s:VideoPlayer):

view plain print about
1player.videoDisplay.mx_internal::videoPlayer.bufferTime = 0.1;

Suck this up and enjoy :-)

Check if Frame Label Exists (in Flash/ActionScript)

A project I've inherited includes a piece of code that sends a MovieClip to a frame with a specific label (in my case the label was 'disabledframe'). Unfortunately some of the MovieClips that extend this base class do not contain said frame label which resulted in a runtime error.
To make matters worse I do not have access to the original assets and adding the rame was therefore not an option. I knew that I could work around this problem by checking if the frame label exists, but couldn't remember how it was done...

Thanks to the power of Twitter and its awesome inhabitants I had the answer delivered within seconds - special thanks to @stray_and_ruby, @stevecarpenter (although his response time to my tweet was at least 24 seconds slower than the first correct answer, he needs to work on that ;-) and an anonymous commenter by the name of DaveW who pointed out a major error in the initial code I posted - oops.

view plain print about
1// assuming you have a movie clip named 'mc' with a label named 'blah'
2trace(movieClipHasLabel(mc, "blah")); // traces true
3
4function movieClipHasLabel(movieClip:MovieClip, labelName:String):Boolean {
5 var i:int;
6 var k:int = movieClip.currentLabels.length;
7 for (i; i < k; ++i) {
8 var label:FrameLabel = movieClip.currentLabels[i];
9 if (label.name == labelName)
10 return true;
11 }
12 return false;
13}
Easy when you know that mc.currentLabels returns an Array of framelabel objects within that MovieClip.

By the way - since we are talking about Twitter - if you enjoy my blog posts then why not follow me?

One Day On: Reflections On Adobe's Flash Announcements

Yesterday, November 9th 2011, was a day that Flash developers will remember for some time to come. It was also the day when Tim Siglin (why did I ever doubt him) was proven right when he posed the question: 'The TouchPad Is Dead; Is Adobe's Mobile Strategy Next?'.

Well as it turns out, yes it is, as Adobe yesterday announced that it will halt any further development on the Flash Player for mobile (the desktop Player is unaffected) and will focus on HTML5 to target those devices. The company also confirmed that the AIR runtime in combination with the Flash toolchain was its preferred choice for building native applications for mobile.
The announcement came shortly after the company announced healthy profits, and a 'restructuring' exercise which will see 750 employees lose their jobs. A sad day indeed.

[Read Full Article]

Setting up Chrome for Debugging on OSX in Flash Builder/Eclipse

Here's a quick tip if you'd like to add Chrome as your default browser (or secondary for that matter) in Flash Builder.

You may have noticed that Eclipse seems to struggle with this if you browse for the location and end up with '/Applications/Google Chrome.app' as the path: it gets rejected as soon as you click 'ok' stating that 'The location value is not a valid path name'.

After a bit of trial and error I managed to find a valid path name after checking out the existing browsers' paths in more detail. Here's what seems to work for me:

view plain print about
1/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

Note that under Windows you may not encounter this issue. Hope this helps someone.

The End for Adobe's Multi-Screen Strategy?

The End for Adobe's Multi-Screen Strategy? - This is a question that Tim Siglin asks in his recent article on the sudden death of the HP TouchPad and WebOS.

My initial reaction to reading that header was one of suspected link-baiting; but since I know Tim well enough I knew that his style of writing goes substantially deeper than that of an attention-grabbing headline (but hey, this didn't stop me from re-using it. You see my standards are far far lower and since you are now reading my post it clearly has paid off ;-).

So does Tim have a point? Does the demise of WebOS and the sluggish uptake of other (non-iOS) mobile operating systems outside of Android really spell bad news for Adobe and its multi-screen dream?

[Read Full Article]

Flash Player 11 Beta 2 Is Out

A few days ago Adobe has released the beta 2 version of the upcoming Flash Player 11 on labs. Apart from adding 64 bit support which was already part of the beta 1 drop this latest release adds a few new features such as support for the JPEG-XR image format which provides better compression and alpha channel support.
The most exciting new feature for developers of real-time audio and voice applications is of course the addition of H.264/AVC software encoding which results in better quality support for webcam based video.
Game developers will likely salivate over the Stage3D APIs code-named Molehill. This is a set of low-level GPU-accelerated APIs which enable advanced 2D and 3D capabilities across multiple screens and devices.

It'll be interesting to see what developers make of this and we will undoubtedly see some previews at the upcoming Adobe MAX Developer conference.

Have you built any applications using H.264 support or Stage3D yet? Post some links in the comments if you like.

To download Flash Player 11 Beta 2 just visit labs.adobe.com.

Why Flash Will Be Just Fine

I've just realised that an email reply I wrote on the FlashMedia List would actually make a good blog post. I wrote it in response to someone pointing once again to the death of Flash, brought up by mobile and HTML5.

Actually I see emerging platforms as a big opportunity for Flash, not a threat. Why was Flash successful in the first place? Cross platform consistency.

[Read Full Article]

Flash Advanced Echo Cancellation Has Arrived - Flash Player 10.3 Beta

Adobe have just released the beta version of Flash Player 10.3 which you can download from the Adobe Labs website.

The major feature in this version - especially if you are building real-time collaborative applications - is the advanced echo cancellation (AEC). Developers can now take advantage of acoustic echo cancellation, noise suppression, voice activity detection, and automatic compensation for various microphone input levels. End users will be able to experience higher quality audio to aid conversation flow, without using a headset.

Most of these features can be accessed via the new flash.media.MicrophoneEnhancedMode and flash.media.MicrophoneEnhancedOptions classes which contain properties to control the way that the Microphone instance enhances audio, suppresses echos and so on. The API docs (.zip) are here.

This beta version is currently available for desktop operating systems, with support for mobile and AIR following soon.

Another great enhancement for end users is the native control panel which allows you to manage Flash Player privacy, security and storage settings on Windows, Mac, and Linux directly from the Control Panels or System Preferences on your computer. I love this feature as the Settings Manager used by previous versions of Flash Player was a usability nightmare. I also think that Flash Player looks muchmore grown up now that it's sporting its own settings panel in the System preferences. A great improvement.

Check out the full release notes and other new features here.

Flash Player 10.2 Is Out

Adobe have officially released Flash Player 10.2 for Windows, Mac and Linux.
This release brings a range of performance improvements and feature enhancements. Worth pointing out is Stage Video, a full hardware accelerated video pipeline that improves video playback performance across platforms and browsers by separating the video playback from the DisplayList and offloading rendering to the GPU (where supported).
Additionally, this version of Flash Player offers all the new capabilities previewed in the beta release, like custom native mouse cursors, multiple monitor full-screen support, Internet Explorer 9 hardware accelerated rendering support, and enhanced sub-pixel rendering for much improved text readability.

Install Flash Player 10.2 now or to grab the debug release version go to this page.

More Entries