Actionscript Basics - Class Files

December 2nd 2006

Spring Digital approached me again with an interesting project. Preparing a Class for their designers to explain a little bit the basics of Actionscripting. I never did something like this before, I mean being a teacher and doing a 4hours session about anything. So I didn't know how it was going to work.

The first idea I had about it was doing my own powerpoint/keynote thingie (I called it keydoob ;)) to prepare slides and keep a bit of structure for the class. Then I had to prepare all the contents and that's where I had some problems as I just didn't know how to prepare something and guess that will take 4 hours to explain answering the possible questions, so as I added a bit more of content just in case.

I had to do the same class twice, for 2 groups of designers, so after doing the first one I amended a bit the slides and I was able to explain everything a bit better.

Although the class was supposed to be about the basics of Actionscript I think I really said a lot of stuff, if I was totally new it would probably damage my mind ;) But I wanted to give a bit of info about everything and stuff that they will probably find at some point, and maybe whenever they test about something they will remember the class and me saying something about it, so they would have a bit of idea or they will feel that they're doing things properly.

So, for the non-attendants (you), I'm afraid I don't have a video or anything of me blabling and blabling but the good news are that I will share the slides, the source file of keydoob, and also the files I created in each class, with the source code (.fla) so you can check some actionscript code if you feel like doing it :)

Actionscript basics 1.1 presentation

(LEFT & RIGHT to change slide)

Actionscript basics 1.1 presentation - source files

3 comments

Flash+PHP, secure high-scores

November 22nd 2006

I've been doing a couple of flash games these days, and there is always that request of having to add a high-score system on the background. Sounds simple to do, but you will get the high-scores hacked very easily if you don't do it carefully. This is the research I've done by now:

The first thing we need to know is that Flash+PHP is totally insecure, you got a program on your client requesting server information. You can always use a program like live http headers in between to check what is the flash asking to the server. Another problem is that you can decompile the .swf with a program like Sothink SWF Decompiler to check out the code and have more information. However I found out this encrypter which by now is doing the job very well.

Long time ago I did another game and my approach on that time was loading a game_loader.php (instead of the .swf itself), and then checking the referer on that .php. If the referer wasn't the one I was expecting, then the .php wasn't giving back the .swf. I thought It was a great idea, but after finding out about cURL it doesn't look any good as you can fake the referers with it.

So the next idea was to try hacking one of the famous games out there to see how do they do it. If you ask me about famous games out there, my first answer will be probably Orisinal. Orisinal have been famous for their cute games, and in the background also have been famous for having non-hacked high-scores list. So that's where I went. So yesterday I spent a couple of hours trying to hack the bugs game. That's as far as I got... to request the table of highscores you only have to access to this link. And then, if you want to submit your score you need to acces to this link. The problem was that the las link wasn't really working as expected. One guess maybe that he could have a code that if there is some IP trying to access to link and without having all the information correctly (like for example seding the Host), then the system adds the IP to a ban-list and from there you can't go anywhere (otherwise I've no idea why isn't working, feel free to push all this further, but keep it serious, please).

After my unsuccesful attemp to hack Orisinal then I moved to the Yeti game. I checked the code long time ago and seemed quite easy to hack, but checking the code this time, I've found that many things to take care of that I just didn't have time to spend that time. So I forgot about it.

So. I guess, a combination of encrypting the .SWF, using a PHP to give back the .SWF in case you're asking for it from the correct URL, then adding a security code on each action, and as the last thing adding a ban list for IPs trying to do weird stuff will do by now. Also, in this case I've a username/password system, so the game only submits the scores if the user is logged. But to be honest I don't think that helps at all.

And that's kind of it, if you have any experience with it, or any suggestion, you know that I want to hear it!! ;)

(More details about hacking Flash Games Scores here)

2 comments

Flash: another nasty thing

November 17th 2006

Anytime you want to copy paste the image you're working on Photoshop to Flash, don't do it by copy/pasteing, it will modify a bit the image sizes.. in instance, if the image is 700px of width, it will paste it as 699.7. And these kind of things make the final product very pixel non-perfect, specially when your flash needs to integrate with the html design.

So, to avoid that, save the image as PNG or something and then import in on flash. Very silly thing but it really means a lot!

1 comment

mrdoob.com, finally an ID

November 5th 2006



Yey, I've finally done a logo/style for myself as webdesign/dev freelancer. Until last week I had phodoob as homepage and I didn't like the idea of having pictures of myself in parties and stuff when showing my website to clients ;)

Well, I didn't care that much but well, I made a holding page by now.. slowly but secure :D

1 comment

kocka09 : Now with camera

October 30th 2006



What a name, uh? Well, after finding this tutorial/paper on friday I spent quite a lot of hours implementing it to my 3dengine in flash. I've to say that there are a couple of bugs on that tutorial (but I won't say which one are :D). Also I had to find a way to implementing 4Dmatrices and Vectors to the code (as Actionscript doesn't have them). So, yeah... 'Now with camera' may sound simple, but isn't (atleast for me).

Again, a bit of history. All this started when Gargaj sent me 2 years ago (?) a .fla with a 3D test he did. It was just a cube (kocka in hu) rotating, with circles on the dots. Starting from there I got interested on it, and learnt all the theory behind the 3dengines and wrote from scratch a new engine which I decided to call it kocka as a tribute to the original kocka.fla :)

So, well, now it has a camera... the controls aren't done properly yet, I'm trying to find the way of doing quake-like camera control, I guess it will take a bit more of time :)

However I guess I'll stop the dev of it with AS2 and move it to AS3... I'm really looking forward to see what's the improvement in this example :D

11 comments

Flash player 9 beta for LINUX!

October 19th 2006

Althought this is going to be one of those noise posts (as thousands of people will write one like this), I think the news is too good that I have to.

Adobe has finally released their Flash player for Linux. That means a lot of expansion (and also some people won't be able to complain whenever I try to show them my stuff done with flash9 :P)

http://labs.adobe.com/downloads/flashplayer9.html


PS: Oh, looks like M$ released IE7 too, but... who cares?

1 comment

exe2swf

September 28th 2006

There was this guy on Domestika asking if it was possible to convert a .EXE (which is actually a Flash) to .FLA again.

I had a similar problem some time ago when doing Rolf Harris website. We didn't have any rules for storing the files at Spring by that time, and one of the results was losing the .FLA for the homepage flash. Luckily Sothink SWF Decompiler did the job well. It added a little bit of crap but it was quite reusable.

However, in this case, the guy was asking for an .EXE (Windows projector) decompiler, and I never saw that option with the program. So, I had a fast thought about how to fix the problem, and applying what I learnt with Madgoblin's steganography I had a little hack for it in a couple of minutes. So, in case anyone elses need it, here you have:

EXE2SWF

I've tried it with a couple of .EXEs and it works. Let me know if it doesn't with yours.

5 comments

Rotozoomer with ActionScript 3

September 27th 2006



Hehehe, yep, finally moving to AS3. So, I didn't know a better way to start learning the new changes than porting one of the olschool effects that I did with AS2.

See it on movement here.

AS3 gave something like 5 more fps to the effect, but as you can see it's still slow. If you think you can make it faster:

Download the sources from here.
(You may want to delete anything fps related first)

PS: Should I have to say that the texture is from the demo Second Reality?

9 comments

Flash player 8 onKeyUp bug

September 19th 2006

What a silly bug made me lose quite a bit of time!!!

Ok, If you were planing of doing a game controled by the keyboard for Flash player 8 you'll find a little BIG issue. Using this code:

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
    trace("PRESSED -> Code: "+Key.getCode()+" ASCII: "+Key.getAscii()+" Key: "+chr(Key.getAscii()));
};
keyListener.onKeyUp = function() {
    trace("RELEASED -> Code: "+Key.getCode()+" ASCII: "+Key.getAscii()+" Key: "+chr(Key.getAscii()));
};
Key.addListener(keyListener);

Then, if you doing this sequence:
1. Press DOWN  (40)
2. Press RIGHT
(39)
3. Release RIGHT (30)
4. Release DOWN (40)

You'll get this result exporting to with Flash
player 7:
PRESSED -> Code: 40    ASCII: 0    Key:
PRESSED -> Code: 39    ASCII: 0    Key:
RELEASED -> Code: 39    ASCII: 0    Key:
RELEASED -> Code: 40    ASCII: 0    Key:


However, with Flash player 8 player you'll get this:
PRESSED -> Code: 40    ASCII: 0    Key:
PRESSED -> Code: 39    ASCII: 0    Key:
RELEASED -> Code: 39    ASCII: 0    Key:


As you can see, Flash player 8 forgets which Keys you pressed as soon as you press another one, but without releasing the previous ones. Which may cause that your ship goes down automaticly.

Well, atleast looks like they've fixed this issue already in Flash player 9.

8 comments

byebye: the solution

September 7th 2006

Hehehe, this thingie end up being quite fun! Didn't expected it to be that dificult for everyone!!

The GIF format was the shit years ago. 256 colours (8bits)! You could do a lot with that!! But, all of these 256 could be exactly the same colour, you can customise the palette however you want, in fact, with good old programs you could even move the colours in the palette. Quite a lot of games used the trick of using the first colour in the palette as transparent colour, so the graphician had to setuop the palette of the graphic like that.

The trick was that 2 colours (even 3) where black (I added a transparent one because a "bug" with irfanview). In order to show the text, you have to change one of those colours to any other colour :D That trick was very used by graphicians long time ago, they used to add hidden text (greetings to other graphicians) in the empty parts of their graphics. Isn't it cool?!

Here you have the steps:



Select the first colour:



Change it to white, and that's it!



Now you should see this:



Here you have a bunch of cool pics that use this trick.

2 comments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Some of the projects that I worked on.



Some of the HTML5 and Actionscript experiments I've done.