Tag Archive for 'as2'

MouseEvent.ROLL_OUT troubles

Just great :( Just when I thought I mastered the MouseEvents in as3 (after trying almost every combination of MouseEvents, buttonMode and mouseChildren) I found a new problem situation; only this time I can seem to find a solution.

The situation looks like this:
If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

- The two shapes are siblings so they have the same parent (i.o.w. the two shapes can’t be nested).
- The blue oval is on top of the green rectangle.
- I want to know when the mouse leaves the green rectangle.

The problem is that the green rectangle dispatches a ROLL_OUT and MOUSE_OUT event as soon as the mouse hits the blue oval.

I tried all combinations of mouseChildren, buttonMode and enabled on the oval and on the parent of the two clips, but nothing seems to make the oval not “steal focus” of the rectangle.

Here is the source of the test: Rollout test (zip)

I can think of some workarounds (hitArea, using an invisible button, etc.) but I much rather find a straight way to handle this kind of situation.
Since this was never a problem in as2 I believe there should be a decent solution in as3 as well.

If someone has an answer to this problem or knows about a secret property I haven’t tried, please let me know…

Jolly jellyfish

At the moment I’m trying to learn how to make timeline animations in Flash and yet somehow I end up animation which is 80% coded, isn’t that just great!?

Just fooling around I came up with this result:
If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.
Jolly jellyfish - vector animation | download

The movement and generation of the jellyfish is all actionscript (2.0), the “squezing” is timeline-animation…

0.1*3 = 0.30000000000000004

Isn’t this just great? I stumbled upon this problem in actionscript a while ago, but at that time I just worked around it and never bothered again… until today. A colleague came to me with the same problem and I decided to investigate a little more.

Apparently it is some weird bug when it comes to multiplying decimals values by 3. Take this little script for example:

1
2
3
4
5
var j:Number; 
for(var i:int=0; i<10; i++){ 
	j = i/10; 
	trace(j+"*3 =\t"+(j*3)); 
}

It outputs:
0*3 = 0
0.1*3 = 0.30000000000000004
0.2*3 = 0.6000000000000001
0.3*3 = 0.8999999999999999
0.4*3 = 1.2000000000000002
0.5*3 = 1.5
0.6*3 = 1.7999999999999998
0.7*3 = 2.0999999999999996
0.8*3 = 2.4000000000000004
0.9*3 = 2.7

And it doesn’t stop just there. The same problems occur when adding a decimal value to the double of it’s value:

1
2
3
4
trace(.1+.2) //0.30000000000000004 
trace(.2+.4) //0.6000000000000001 
trace(.3+.6) //0.8999999999999999 
trace(.4+.8) //1.2000000000000002

The problem occurres in Javascript as well as in Actionscript (and probably some other languages too) so it’s probably caused by the way decimal values are treated at byte-level. Because it’s not likely there will be a fix for this soon, here is a little workaround:
i = int(i *10)/10; //use int() in favour of Math.round() to speed up the code

labs.justgreat.nl :: now with 100% more experiments!

Isn’t this just great! I moved my experiments tot the “labs”-domain of justGREAT.nl and I added all of my old experiments (at least the ones that are worth mentioning).

It took me a while to regain the creation-dates, make all experiments ready for displaying and creating the thumbnails, but finally I’m finished :D

Check out the new labs-section here: http://labs.justgreat.nl/
Put it in your favorites because I’m going to post at least one experiment a week (really!).

Drop a line if you like them…

Where is my as2 remoting in Flash 9?

Just great! I installed Flash 9 and was happy I could finally throw out the old Flash 8 version only to find out that I couldn’t  compile my old as2 remoting projects in Flash 9. At Adobe they were smart enough to include remoting in as3 but they totally forgot to add it for as2 as well. Checking the (Flash 9) help led me to the site where I can only download the Flash 8 remoting installer which can’t be installed for Flash 9…

Very smart Adobe! :|

Fortunately I thought of an easy way to get this problem solved; simply copy the remoting classes from Flash 8 to some other directory and set this directory as one of your default Flash 9 – as2 – classpaths. (Copying it into the default classpath with all other default classes didn’t work for me somehow.)

To make it easy for you I extracted the remoting classes and put them in a zip: as2RemotingPackage.zip

PS: I coudn’t find any info about this on the internet so either nobody ever needed it, nobody ever bothered to try and find a solution or this solution is so simple nobody ever bothered to write about it.
Anyway I bother to write about it for those of you who couldn’t find a solution or just didn’t bother to find one.

Hope this will help you… :idea: