Monthly Archives: October 2012

How an embedded swf messes up your code and how to avoid that

When you embed another swf into your code, maybe this operation will break everything appart. That depends on the classes you use. If these classes have same names but different functions here’s your reason.

The problem is that these swfs share the same application domain. You have to set a LoaderContext with the parameter allowCodeImport to true, but if you want to make them completely seperate, then in the same LoaderContext you’ll have to set a new ApplicationDomain. That sets the two swfs seperate, but that also means that both of them can’t communicate with each other, and neither share the same stage property. So you won’t be able to dispatch any events, except set the initial LoaderContext parameters.

That thing took me some hours to find out…

One last, maybe useful thing. You can also embed a swf, but it won’t work as is. The embed must set the mimeType=”application/octet-stream” variable. That’ll make the swf a ByteArray. After that, you can load it with a Loader, as you would load an external class by instantiating with the new keyword.

A bit of Guild Wars 2 design

I had the pleasure of playing Guild Wars 2 few days after it got released. I’ve played it since the open beta from which I was really disappointed but said “wtf it’s one time pay only”, and since some of my friends bought it, I followed.

One of the first things I learnt is that the “one time pay only” is a catch. The game and the following expansions will have the value of numerous monthly subscriptions. It’s a risky marketing trick but it seems that it works to attract customers. Overall the game is well furnished. From beta to release there were many improvements. Even after the release the patches were huge, and the gameplay was really fun. Unfortunately I didn’t play with my friends but that didn’t have much impact in the fun. Read the rest of this entry

Center pivot point on a sprite

There’s been a long time since I’ve updated this place. Well, real life has gotten me. My time has been divided between work, and Diablo 3 (yeah I know….). These days at work have been very anxious (and still are). There are a tons of things that I want to write, tons of game tutorials I want to add up, but I just keep delaying it. My bad I suppose, but it’s never too late (or so they say).

This time I had an old school problem in as3. I wanted to rotate a sprite, with its pivot point centered. But as you probably know in as3 the pivot point is always at the top left of the sprite, and it can’t be moved except if you are using Adobe CS Flash. Actionscript junkies are left ouf of this. Now there is an algorithm based on mathematics that you can use, but there is an even easier way for this. You probably know it but as I am self-taught I didn’t and spent a lot of time to find it, I guess I could help others who doesn’t know it either. Read the rest of this entry