04 November 2010

FlashPlayer 10.1 Throttling Problems

While the idea to throttle SWFs in inactive or minimised tabs/windows down to 2fps to reduce CPU usage is a good thing, it can cause havoc with SWFs that use both time-based and frame-based timing.

The frames will tick at 500ms, yet any time based event will still fire after TIMER_COMPLETE or after setTimeout(). You cannot rely on sequencing between the two, which is not a good idea anyway, but potential problems are made worse by the throttling.

If possible, do not mix frame and time based sequencing (which is good practice), but if you need to know when the SWF is minimised you can listen for:

Event.ACTIVATE
Event.DEACTIVATE


Now, this works on FF 3.5.15 with FP 10.1, it may behave differently between browsers and FlashPlayer versions, so it could be fairly unreliable.

In another experiment, I played a silent audio track while it was minimised, this kept the movie running at 8fps, which gave better resolution which was just enough to prevent some of the timer / frame sync issues, but again wasn't 100% reliable.

In short: don't mix your timers, try and keep it frame based. Until Adobe roll out an event we can use to detect throttling, we're stabbing in the dark.

08 October 2010

XML.appendChild FlashPlayer 10 - Known Bug. But wait...there's more!

I just hit a problem with XML.appendChild not accepting String values when you publish a swf for Flash Player 10.1

Doing this:
myXml.appendChild("<node>"+value+"</node>");
Will not work, this will:
myXml.appendChild(<node>{value}</node>);

Which is fair enough as it's strict E4X. What irks me is something that has worked now doesn't, which has caused problems with our custom swc API libraries that I've just spent a few hours fixing.

In the release notes for Flash Player 10.1 there is this entry:
"XML.appendChild does not function correctly when published as SWF10; works fine as SWF9. (2340839)"

"works fine as SWF9" - thanks! Not "fine" when I'm trying to implement 10.1 specific features.

Read those release notes some more and you discover fundamental issues:
  • [FP-1569] AS3 Timeline: Child Sprite ADDED_TO_STAGE event is fired twice. (2300936)
  • AS3 Timeline: First frame of Movie Clip animation played twice when created and added to stage with ActionScript. (2520095)
  • [FP-4423] onEnterFrame gets called more often than necessary. (2614589)
All of which look to be related at some lower level.

So as long as you're not doing any Flash development that requires listening to ADDED_TO_STAGE, or that requires accurate timing when adding MovieClips or using onEnterFrame, you will be fine!

And I certainly won't be using this post to rant about how such critical issues with fundamental features that have worked correctly for years have passed through Adobe QA with little more than a footnote which itself was missing two important words: "Oops, sorry!"

22 September 2010

Russ Rolling. It's like Rick Rolling, but worse!

Yes, that annoying habit of Rick Rolling is so last decade. The new video of the times is Russ Abbot's "Atmosphere", a #7 UK hit back in 1984. It's pretty awful, but what's worse is that it sticks in your head like a botfly larva.

Russ Roll someone today: http://www.youtube.com/watch?v=RFPLk5mJ1D4 , they'll hate you for it.

26 May 2010

Time to learn HTML5? No... learn Android

All the media hyperbole surrounding the recent Steve Jobs rant about Flash has given HTML5 a boost. Reading various blogs and Apple Fan Boy comments would lead you to believe Flash is dead and we're all going to be out of a job in the next couple of years. This is far from the truth. Already Flash is part of the Open Screen project and there will soon be an AIR runtime released for Android.

HTML5 is a long awaited update to HTML and, yes, it will render certain applications of Flash redundant, crappy add banners for one - and good riddance! However HTML5 is still not fully supported by all browsers and until browsers support a Javascript language up to ECMA 3 standard, it just feels like taking a step back into the archaic days of AS1 and Flash 4!

Apple don't want to support Flash for various reasons and they will push along with HTML 5 and Objective C apps on their closed software platform. Flash is part of the Open Screen project being adopted by all major mobile phone manufacturers, except one... guess who!? iPhone app development is a tempting prospect but it's current popularity, mainly due to lack of competition, will be eroded in the months to come as the mobile phone giants start to offer their own alternatives. Once this happens, the iPhone will look isolated on its proprietary island as apps able to run on a multitude of devices will begin to dominate the market. However, it will be harder for developers to make money in this open arena. It also remains to be seen if Apple really are turning into the Mobile Microsoft and try to stifle development of open source products and force you to use their OS and apps. Unlikely.

Flash, Flex and AIR are perfectly poised to enter the Open Screen app space, so really, you could stick with what you know. Yet, if you're feeling the cold hand of progress pushing your office chair towards the exit, learn HTML5 by all means, learn Objective C if you dare, but those of you with Flash/Flex or Java experience should learn Android as soon as you can