Ruben’s blog

Ruben Swieringa on Actionscript and a whole lot of other stuff..

Your Flex project overwrites your modules their styles

This afternoon I found out that when you're defining styles for the same selector in your main Flex application and in one of your modules, the latter style-declaration will not be used, at all. I'm not sure whether this is a quirk that has yet to be documented or that it's something that has already been covered in the LiveDocs, but any feedback is welcome.

Read the rest of this entry »

“could not resolve <mx:…> to a component implementation”

If you have ever tried to add mx.core.ToolTip (or certain other classes) as a mxml-tag to your Flex project then you might've run into the following compiler-error:

"Could not resolve <mx:ToolTip> to a component implementation."

So why does Flex (or rather MXMLC, the compiler) let you write <mx:Button> and <mx:Canvas> and all those other Flex components, but not <mx:ToolTip> -- it's a native Flex class and it's in the mx package just like all of the others, right?

Fact is, it's not the mx class-package that defines whether or not you can add a component by saying <mx:...>, but rather the Flex component manifest file -- it describes which of the native Flex classes fall under the mx xml-namespace (or actually any namespace you want to use). I might write a post about manifest-files in Flex somewhere in the near future, but for now you'll have to read up in the docs if you want to know more.

It so happens that the ToolTip class isn't included in the native Flex component manifest, and consequently the compiler won't be able to find it if you just write "<mx:ToolTip />". You can work around this by specifying a seperate xml-namespace for the mx.controls package:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:controls="mx.controls.*">
    <controls:ToolTip />
</mx:Application>

Note that in the above example we can't change the value of the xmlns:mx attribute so that it would point to the mx.controls class-package, because if we would then the compiler wouldn't recognize the <mx:Application> tag anymore (since the Application class isn't in the mx.controls package).

Also, for the naysayers who completely miss the point and start talking about why on earth you would want to instantiate a ToolTip through mxml: To tell the truth I was wondering about this myself, but if you think about it, tooltips in Flex aren't restricted to just having whatever you put into UIComponent.toolTip automatically pop up when you mouse-over. In fact you may want to create a custom mxml-component subclass of ToolTip and manually add it to your application using the ToolTipManager class during runtime.

That having been said, ToolTip isn't the only Flex-class not included in the Flex component manifest, naturally what I wrote in this post also applies to any other class in the Flex framework that extends UIComponent but isn't included in the manifest.

Flash Player 10 crashes Internet Explorer with H.264 video

At work we ran into this bug the other day, looking into it I found out that Adobe hasn't put any effort into documenting this one so I thought I'd give it a shot myself in order to try and raise awareness.

In short, the bug occurs with Flash content playing H.264 video in Internet Explorer with certain version of the Flash Player older than 10.0.32.18. Under these circumstances, if the video its playhead is set back to the start (seeking) then Flash Player will crash Internet Explorer -- not slowdown-crash, but actually end the process; the browser-window will be closed down (and with that, your Flash application).

We had this bug occur in both Internet Explorer 7 and 8, and upgrading the Flash Player to a newer version (10.0.32.18 or later) made the problem go away. I'm not completely sure whether this problem has been present since HD video functionality was introduced in the Flash Player, or that perhaps it only started later on. The computers we experienced this bug on though, had either Flash Player 10.0.2.54 or 10.0.12.36 installed.

I don't exactly know in which part of the native Actionscript libraries this issue starts, I presume it's in the VideoPlayer class (as I take it that that's where the actual video logic is implemented), but it might as well be in the FLVPlayback component.

Of course any additional information is very welcome, leave it in the comments. Also, there's this one thread in the YouTube Community Help Forums that was somewhat helpful, check it out if you're interested.

Flash on the Beach 2009 (photos)

I don't really feel like doing a full recap of three days of this year's Flash on the Beach (even though I had a most wonderful time), but some shots and videos I took came out pretty well, so I thought I'd post 'em (more photos on my flickr):

(above: Joshua Davis doing the very last session of the conference.)

John Davey revealing the winners of the infamous flipflip-photo-contest at the end of the conference

Joshua Davis

Joshua Davis and his funky dance-moves

James Jarvis

Camera-guy during James Jarvis' session

A different use for custom namespaces (2/2)

This post provides some example-code for the concept presented in my previous post, please note that this post serves only to add some concrete material to the abstract idea presented in the previous post and that the focus should be on the latter rather than the former. This post is not at all about best practices or good/bad code-architecture.

Read the rest of this entry »