August 26th, 2010 by André Gil.
I’m working in a Flex project and the client asked for some Keyboard Shortcuts. It works great on Google Chrome and IE but, for some reason, Firefox doesn’t handle embedded objects focus correctly sometimes.
To “fix” this problem, I found a really nice workaround. First, you have to open your application on some browser and look at the source code. Then, look for the <object> tag “id” attribute inside it. If you use the default Flex template, it will probably be your Application name. In my case, it’s “index”. So I wrote this JavaScript line to set the focus on your application again:
1
| document.getElementById('index').focus(); |
Now, to use it on your code without rewriting your template, you can do this:
1 2
| navigateToURL(new URLRequest("javascript:try{ document.getElementById('index').focus(); void(0); }catch(err){}"), "_self");
someComponent.setFocus(); |
It works better if you try to identify when your application is loosing the focus (always when I opened a popup, in this case) and put the code after that. I also used a try/catch to avoid problems, like if the user opened the SWF directly.
I hope it helps someone!
Bye o/
January 24th, 2010 by André Gil.
Some weeks ago I started studying some animation techniques in Flash games and I started making some Blitting experiments. I will post something about it soon, but the point is that to make an animation you first need the graphics and, as your probably don’t know, I suck at drawing! So the first step was ripping some sprites and I remembered about some really nice animated GIFs I’ve seen some months ago.
So I got the GIFs and tried to find some tool to extract all the frames and I didn’t find anything good for it. I know I can use the Adobe Fireworks to do that, but then I will have to copy frame by frame at the perfect position to do the blitting… So I’ve decided to make my own tool to do the job!

Using the as3gif project I wrote a very simple and experimental tool to do the job and I decided to publish as Open Source to, maybe, help somebody else that is studying those techniques. You can even get the code and see some blitting there too!
On this example I used the character “Infierno Púrpura” from this really beautiful final project game called “Ay, Caramba!” (thank you Jujuqui!):

And I’ve got this result:

So that’s it! Check out the Gif2TileSet demo and, if you really like it, fork the code on GitHub and make your own improvements.