Monday, August 24, 2009

Google does SVG for IE ... with Flash

From Slashdot:
"Scalable Vector Graphics (SVG) is in most graphical tools. It is used heavily in many big projects, such as KDE and Wikipedia. But Internet Explorer's lack of built-in support for SVG was keeping it away from mainstream use on the web. Google is fixing that now with a JavaScript drop-in named SVGWeb. They've posted a quick, one-minute overview, a longer and more detailed presentation, and you can read about it on the project page."

Read the comments.
I wondered what clever trick they could possibly be doing to have JavaScript represent SVG in IE. Canvas? ActiveX? SilverLight? .NET? Nope: Flash of course. If your browser has decent native SVG support (read: basically all browsers except Microsoft's) then their snippet simply falls back on that. Otherwise it pumps all of that into Flash and does a remarkably good job.

I think the idea is fantastic and it tickles me pink that Google is using one proprietary product (Adobe's) to supplement a feature in a competing company's (Microsoft) browser. Everyone wins! Critics tend to bemoan the reliance on a plug-in, even one ubiquitous as Flash, but then they're not the ones using Internet Explorer so the complaints are moot.

In only minimally-related news (still for nerds, and it might matter), I highly recommend everyone go see District 9. My girlfriend disliked it, I loved it, but we both agree Sharlto Copley does a fantastic job as the lead character. I had no idea how important he'd end up being as I didn't read anything about the movie beforehand, and the surprise lent extra awesomeness to the experience. Also, the score is great too.

Thursday, April 16, 2009

ArgumentError: Error #2173: Unable to read object in stream ... does not implement flash.utils.IExternalizable

ArgumentError: Error #2173: Unable to read object in stream.  The class does not implement flash.utils.IExternalizable but is aliased to an externalizable class.

This error seems a little backwards to me.

This is caused by a class being sent from the server that implements IExternalizable but is not compiled into your project.

You can fix it by forcing the linker to include your class definition with something like this:

private static var _link:Array = [com.bakedon.YourClass];

Saturday, February 09, 2008

Restrict SharedObject Name

FluorineFx makes it extremely easy to get Remote SharedObjects up and running, but I found it difficult to intercept the requests made against the server. My main reason for needing to do this is security: you don't want clients to be able to create arbitrary shared objects all willy nilly, otherwise you're just asking to be smacked with a big, bad bandwidth stick. Unfortunately my calls for assistance were met with silence, but I don't expect much support from developers working under the alias "The Silent Group"! So I spent the last week digging deep into the source code and trying to unravel the mysteries behind the adapters, wrappers, brokers, contexts, connections, clients, and scopes.

Thankfully, today I solved the main part of the mystery and what this post is about. Let me tell you the secret, add this to your application handler class (the one that derives from ApplicationAdapter):

Intercept SharedObject Additions

new public bool AddChildScope(IBasicScope scope)
if ("SharedObject" == scope.Type &&
"expected_name" != scope.Name)
return false;
return base.AddChildScope(scope);
You'll want to change the if statement in order to make this work better for you, but otherwise this is how you wedge yourself in between the creation of shared objects on the server. You still can't have your own class be instantiated, but you can prevent rogue clients from utilizing arbitrary RO's. Also be aware that there is no way to distinguish whether the request is being made by a client or your server code, it's all or nothing: either an object is available and shared with everything or completely unavailable.

On the client-side in ActionScript you'll need to check the return result of the SharedObject class's connect() method which will give back false on failure or true on success (despite what the documentation may say).