donderdag 19 mei 2011

Keyboard focus loss

A while ago I posted the problem with a container that loads a swf.
There is no problem, when you keep de swf displayed, but if a user clicks it and you take it off the stage, it takes keyboard focus (and all other focus) with it.
There is (as always) a simple solution:
Handle all key-events in the container or a seperate class and add this:

stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
private function MouseDownHandler(evt:MouseEvent):void
{
   stage.focus = this;
}
And presto you have focus on this class.
This might cause a problem with other focus events, which need focus to be on the loaded swf, but for now it works fine with me..

donderdag 28 april 2011

Chat with an adobe bot actually saves the day!

Chat InformationThank you for choosing Adobe. A representative will be with you shortly. Your estimated wait time is 0 minute(s) and 25 second(s) or longer as there are 1 customer(s) in line ahead of you.
Chat InformationYou are now chatting with Bala.
Bala: Hello! Welcome to Adobe Customer Service.
Ludatic: Hi Bala
Ludatic: Did you read my question?
Ludatic: It's a compilcated one
Bala: Hello.
Ludatic: Yes hello
Ludatic: are you a bot?
Bala: I understand that you are unable to activate the CS 3 software on the computer due to old computer crashed and could not be deactivated. Is that correct?
Ludatic: Yes
Ludatic: but there is an additional issue
Bala: I will be glad to help you with this, to locate your account may I have your full name, email address and serial number of the product that is registered with Adobe please?
Ludatic: Hjalmar Snoep, my-email, Adobe Flash CS3 Professional (Windows,English) 1203-1754-0165-7854-5162-0492  (the number on this blog has been changed)
Bala: Thank you.
Ludatic: They tell me this number is invalid now, because I upgraded to a dutch version of cs4 (inadvertently)
Ludatic: and exchanged it to a english version
Bala: Sorry for the wait. Please do stay online.
Ludatic: ok
Bala: Thank you for the information.
Bala: One moment please.
Bala: Thank you for waiting online.
Bala: I have checked and see that the serial number 1203-1752-0768-7553-3192-2345 cannot be used to due to return : swap.  (the number on this blog has been changed)
Bala: However there are CS 3 and CS 4 flash pro serial numbers registered under your Adobe account.
Ludatic: Do you mean I can use a different serial for cs3, because I got a new serial with the upgrade/swap?
Bala: Please use the CS 3 flash pro 1230-2175-3184-7765-4321-1234 and CS 4 1234-5678-9012-3456-7890-1234 serial number to activate the software. (the numbers on this blog has been changed)
Ludatic: Ok, I'll try
Bala: Sure please.
Ludatic: ok it now asks for the serial from which I upgraded from mx
Ludatic: (flash 6)
Ludatic: Do i give it the original number?
Bala: There is no need to enter the original full version serial number again, since you have upgraded from CS 3 to CS 4 flash pro.
Ludatic: yes, but cs3 was also an upgrade from flash 8
Ludatic: which was aslo an upgrade from flash 6 (mx)
Ludatic: I have all the serial numbers
Bala: However if you are prompted to enter the serial number, please enter the flash 6 serial number FLW600-12345-67891-23456.
Ludatic: ok
Ludatic: ok, it's trying to activate now!
Ludatic: It's succesfull!
Ludatic: Thank you!
Bala: That's great!
Ludatic: It is!
Bala: You are welcome.
Bala: Is there anything else I can help you with?
Ludatic: No, thanks!
Bala: You are welcome.
Ludatic: I'll just go and cleanup the hate-raves !
Bala: Please be informed for future reference that before uninstalling or reinstalling the product or making any major changes to the system you need to deactivate it first otherwise it is counted as an activation to the product license.
Bala: I hope this resolves the issue.
Bala: If you have any more questions, please feel free to contact us back so that we will be more than happy to help you further.
Ludatic: It does
Bala: You may receive an email survey in reference to this interaction with Adobe. Your feedback is very much appreciated.
Bala: Thank you for contacting Adobe.  Goodbye!
Ludatic: one more problem
Bala: Yes please.
Ludatic: I'm trying to register, but at the country box, there is no enrty for Netherlands
Ludatic: there is for Netherlands Antilles, but that's not were I live
Ludatic: How do I register, when I live in the Netherlands and want to be truthfull?
Bala: Please be informed that the serial numbers are already registered under your Adobe account, All the Adobe products can be registered only once. Now you can skip the registration page and continue using the software.
Ludatic: oh ok
Ludatic: thanks
Bala: All the serial numbers are registered under hjalmar@ludatic.com.
Bala: You are welcome.
Bala: I am happy to help you, Do you have any more questions for me today?

I am not alone

Everybody seems to hate adobe, or at least this stupid activation system.

http://blogs.creativecow.net/blog/493/i-hate-adobe-activation

http://stevesrantsnraves.blogspot.com/2007/03/why-i-hate-adobe.html

http://forums.adobe.com/message/2702802

I know, some of these are rants and raves about programs not working, which is a totally unrelated issue from mine. BUT I have had my fair share of not working adobe products and now with CS5 it's a daily battle. I'm thinking about a career change, and I have been a flash-expert for more that 10 years now!

I hate adobe

I'd never thought I'd say thisI have been a user of flash, nice and official, since FLASH 2, when it was still a macromedia product. I was invited and went to flash camp and was one of the speakers when flash-lite was introduced..
Me and adobe, I thought we were chums, but these guys NOW ripped me off.

When cs4 appeared, I upgraded of course. Adobe recognised me as being Dutch and automatically gave me a Dutch version of flash cs4 professional..
Getting used to a new interface is hard enough, but this was nonsense.
They had translated everything, "Actionscript" could only be found as "Handelingen" for instance.

So I called the help desk, explained the problem to a very nice lady, who then said she could exchange the program for an English one.. Oh joy!
She did tell me however, that this would mean that the serial I upgraded from, would become invalid. I could not accept this, because I couldn't work with CS4. If I imported a bitmap to the stage, for example, it crashed. If I touched the text-settings, it crashed. That apart from the language problem, was a deal-breaker for me.

So I explained to her this was NOT an option I also said why. She agreed and said I could exchange the product without canceling the CS3 I upgraded from as long as I would never use the Dutch version of CS4 again. This was not a problem for me, because I couldn't work with it anyway. I only ever used it to open stuff I got from people who were working in cs4 and saving them back to cs3.
So problem solved.. I exchanged the product.

NOW my flash cs3 has crashed. I try to reinstall, but my activation has worn out. Yes, with this new crash I lost another one of those stupid activations. I had allready used up three or something. So I call.
But the guy on the phone tells me, all very polite that he cannot help me.
The serial I upgraded from has been canceled. So now I have two options:
1. buy a new license for adobe CS3 professional (which I don't think they even sell anymore)
2. get one illegally and risk viruses and what not.
AND THIS IS A LEGAL PRODUCT I BOUGHT AND PAID FOR.
Also, this upgrade cs3 pro was a upgrade from flash mx, which was a upgrade from flash 5.. All sitting in on my shelves, useless BECAUSE ADOBE CANCELED THEM!

I cannot reach another conclusion than: I hate adobe. This doesn't make sense anymore.
They are punishing good users, who buy all their stuff, the minute it comes out, because there are illegal copies and hackers.
Up to now, I haven't used any warez, not because I couldn't get them, but because I chose NOT to. I am a programmer and I think when somebody makes a good piece of software they should be rewarded for that.

I am amending this policy. The rewards and the ways of getting them should remain reasonable and Adobe just crossed that line.
So I'm going to try and get a illegal version (it's easy you just search for flash, crack, serialz or warez and make sure you have a GOOD virus scanner installed!) of CS3 professional to finish the job I started when my original official version of CS3 crashed.
I dare them to come after me with their fancy lawyers, I have bought the right to use this program.

I will keep using cs5, of which I have bought the MASTER SUITE recently, but I wouldn't hold my breath until they'll see another penny from me.

dinsdag 15 maart 2011

making shards with BitmapData as3

Get Adobe Flash player

Playing around with BitmapData in flash and using the copyChannel on the alpha to create custom shards of a mc. You can provide a breakage pattern. This was used in a project where you had to smash avatar pictures of your friends in hyves.
Source is here. (flash cs3, as3)

Class for Physics Rigid Body with Sentries

There are many ways to do physics calculations, but in games you are always thinking about speed.
Physics calculations are generaly heavy calculations. Also most optimalizations require complex mathematical models to be created or limit the shapes you can actually collide.
One of the most elegant ways to do rigid body physics I ever found was one that used vertex-integration (like most) and a the concept of sentries.
Here you see how this looks:
First you make sure your movieclip rotates where most of the weight is. In this case a little bit more to the bottom.
Then you create a movieclip inside the object (the car), called 'perim' (for perimeter).
Along the perimeter you place sentries, empty movieclips (in this case they are small white squares) where you want your object to bounce.
Now for each move, you check if each of these sentries hit (with hitTestPoint) another movieclip.
The points find a way out of the bounce object and this influences the speed and rotational speed of the object.
It's that simple.
Here is a result and here are the sources.

donderdag 17 februari 2011

Flash detection of tilted face

The previous version wasn't all that accurate, allthough it was fast.
Now I've made a version that samples an image under a number of tilts and compares the results.
It turns out this is a very handy approach.

http://workinprogress.ludatic.nl/ludatic/facedetection/

I used the deface project as a basis, this is without the tilting offcourse, which as you can see, adds a lot of accuracy.
http://code.google.com/p/deface/