// some codefunction test(){var flashMovie = $('#flashID');
flashMovie.ner("hello");// ALSO BAAAAAAD!}
Also doesn’t work, for some reason Jquery removes the methods associated with the embed tag that is written, and replaces them with only the Jquery methods. So in order for this to work the code needs to be simply:
Since leaving Hunt & Gather, I’ve been (besides relishing the peace and quiet a bit) playing around with some of those Flash libraries I hadn’t had time for. Most tantalizing of which is the Box2D library. I’d attempted to use it for this auto layout class for LDa Architects, but because of time constraints ended up settling for APE which as you can see is a bit out of date at this point. Anyway APE is fine if the number of bodies is small and you only need very basic simulation capabilities (boxes don’t rotate unless they are attached to 2 or more wheels for instance…), but once you wanna do more advanced things, like robots or buoyancy you’ll need a faster more complete engine.
Box2D seems to be the fastest and most current option out there, but it’s got kind of a funky API due in part to being a fairly direct port from C++. The complicated setup is in fact what had kept me from using it for so long, but some better documentation and turorial files available on the Box2D Wiki is making getting started easier. And to make things even simpler to play with, I’m creating a series of wrapper classes that reduce the amount of code needed to get things started.
package com.paperclipped.physics{import Box2D.Collision.b2AABB;
import Box2D.Common.Math.b2Vec2;
import Box2D.Dynamics.b2DebugDraw;
import Box2D.Dynamics.b2World;
import flash.display.Sprite;
/**
* This is a container class to make the creation of Box2D World simpler.
* Box2D r47 or greater required.
* (c) 2009 Collin Reisdorf MIT License
*
* @author Collin Reisodrf
*/publicclass World
{//-----------------------------------------Variables-----------------------------------------//privatevar _scale:Number;
privatevar _world:b2World;
//-------------------------------------------------------------------------------------------////------------------------------------------Getters------------------------------------------///**
* @return Scale set by the user when the world is constructed.
*/publicfunctionget scale():Number{return _scale; }/**
* @return The world object made by the constructor.
*/publicfunctionget world():b2World {return _world; }//-------------------------------------------------------------------------------------------////----------------------------------------Constructor----------------------------------------// publicfunction World(width:uint, height:uint, debugSprite:Sprite=null, showCenterOfMass:Boolean=false, gravity:b2Vec2=null, scale:Number=30, padding:uint=1000, doSleep:Boolean=true){var worldAABB:b2AABB = new b2AABB();
worldAABB.lowerBound.Set(-padding, -padding);
worldAABB.upperBound.Set(width+padding, width+padding);
gravity = (gravity)? gravity:new b2Vec2(0, 10.0);
_world = new b2World(worldAABB, gravity, doSleep);
if(debugSprite){var debugDraw:b2DebugDraw = new b2DebugDraw();
debugDraw.SetSprite(debugSprite);
debugDraw.SetDrawScale(scale);
debugDraw.SetFillAlpha(0.3);
debugDraw.SetLineThickness(1.0);
debugDraw.SetFlags(b2DebugDraw.e_shapeBit| b2DebugDraw.e_jointBit| uint((showCenterOfMass)? b2DebugDraw.e_centerOfMassBit:0));
_world.SetDebugDraw(debugDraw);
}}//-------------------------------------------------------------------------------------------////--------------------------------------Private Methods--------------------------------------////-------------------------------------------------------------------------------------------////--------------------------------------Public Methods--------------------------------------////-------------------------------------------------------------------------------------------//}}
So we had this weird bug, that we were likely the culprit of, but that we didn’t have time to properly find/fix involving SWFAddress, and some JSON and IE 6 & 7. Namely with anything less then IE 8 inclusion of the SWFAddress javascript file was killing the app when we removed it, things worked fine, albeit without deep link or browser history support.
So we needed to have a way for IE8, Firefox, Safari, Chrome (why not even Opera) load SWFAddress, but the rest not, behold:
Clever eh? it’s the extra -->s that do it, so all browers but IE ignore the only the (otherwise standard) conditional code, but still use the script, like we just put a couple of regular old comments up in there. This has only been tested on a few machines so your milage may vary. Lemme know if things workout (or don’t).
We’ve been using SWFAddress for a while now, and while I was cleaning old project files out of Flex I came across my first Flex Test using it. It’s simple, and in fact, SWFAddress has been improved a bunch since this test was made (mostly involving SEO, and fallback links + Google Analytics). Now we’re using it for running our entire navigation schemes for all Flash sites, mini-sites, components, and even in our pitches.
Plenty that’s been heard and said before, but with some good jokes, and relevant to the fans / obedient followers of Shepard Fairey and his arrest in Boston. (Glad I live in Somerville).