Adobe AIR and Webkit: problems and suggestions
I'm doing some complicated things with AIR. Or at least I want to- AIR does not always cooperate. Here is an one problem I have found in AIR 1.0 for Windows.
When using flash content (via an object tag) in an mx:html control, certain events just seem to get swallowed up by the runtime (or perhaps by webkit).
The events that are the most problematical involve opening new browser windows. If using someone else's flash object from the web (a widget, for example), it works fine until you click a link in it. Many launch new windows when run in a regular browser (like an RSS widget), but none perform properly when run in webkit using adobe AIR. I have caught at least one event and it is shown below:
[MouseEvent type="click" bubbles=true cancelable=false eventPhase=3 localX=189 localY=149 stageX=228 stageY=159 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0 commandKey=false controlKey=false clickCount=0]
[object Sprite]
Nothing indicates that an object that links to another web page was clicked nor is there a useful way to identify what the link was- you just know where you clicked in the overall mx:html control. Is there some other event that is fired? Maybe, but I can't find it.
What's curious is that clicks that lead to other behaviors work fine. You can play flash games, use music players, etc. It is just launching the default browser to a web page that fails. I know that if you specifically put in the navitgateToURL command that you can get this to work, but that implies you have some control over the flash code you are trying to use and in this case, you don't. I've also added the allowNetworking parameter to the object tag and set it to 'all' to try to convince webkit to let the flash object open the default browser, but no luck. It doesn't even load the new page into the existing window that the flash object is running in.
My suggestion is that all events in webkit html pages need to be handled or propagated (bubbled) so that you can properly handle them elsewhere, if need be. I'm sure the internals of webkit are well-understood and that this behavior is not a fluke. In other browsers, this is not a problem, so I have to think it is a bug or done on purpose for some reason in AIR.
Here is some code that exhibits the above behavioral problem.
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash" width="400px" height="343px" id="InsertWidget_6ab48d11-c347-4240-8001-ae3752cf2f50" align="middle"><param name="movie" value="http://widgetserver.com/syndication/flash/wrapper/InsertWidget.swf"/><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><param name="flashvars" value="r=1&appId=6ab48d11-c347-4240-8001-ae3752cf2f50" /> <embed src="http://widgetserver.com/syndication/flash/wrapper/InsertWidget.swf" name="InsertWidget_6ab48d11-c347-4240-8001-ae3752cf2f50" width="400px" height="343px" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" align="middle" flashvars="r=1&appId=6ab48d11-c347-4240-8001-ae3752cf2f50" /></object>
Anyone care to take a stab at this?
I'll be posting some other problems soon involving AIR and performance when creating windows with mx:html objects, javascript inconsistencies depending on whether an app is built with flex builder or the command line (very different apps allowed), and a memory problem when using background images to skin an app. New products are such a blast!!