Arrow button KeyEvents and duplicate sounds

I've noticed recently that sometimes the arrow button KeyEvents are not firing, and that sounds place twice for no apparent reason. It only seems to happen in the beta Flash Player 10.2. Small rant here, but this far into the game, I would think that these sort of bugs would be fixed by now.


Ad sever's outdated clickTag code

Why does every ad server still state in their specs to write the clickTag code like this:

on(release) {
    getURL(_root.clickTAG,"_blank");
 }

Any developer worth more than $7/hr would only write code this way if they were working in Flash 6, and it was back in 2007. Writing directly on MovieClips is a horrible habit to get into, and makes it very difficult to find and edit code.

In the past, I have completely ignored this requirement, and just written it in my pseudo AS2 Document Class, or directly on the timeline if it's a simple enough banner to not require a Document Class. However, 50% of the time I would get pushback from some project manager at the ad server who knows nothing about code, saying that it was done wrong. I would then spend 2 or 3 hours going back and forth explaining why it is correct, and convincing them to just test it before they pass judgment.

Lately, I've just given in and done it the crappy old fashioned way, because I'm tired of having this argument with them.

So I'm writing here to Ad Servers as a last plea - PLEASE UPDATE YOUR SPECS TO ALLOW FOR PROPER CODING!


Flash CS5 finally working with FileVault on!

Thanks to an anonymous comment, I have found out that Adobe has released a hack to fix the "Error opening URL" error in CS5.

It was determined that FileVault was indeed causing this issue. Turning it off was the easy fix, but for those of us who can't do that, we were stuck without CS5. Adobe didn't release a patch, but did release a file to replace in the Commons folder. See link for instructions.

Seems to have worked for me, and that makes me somewhat happy.


Mantracker Episode Airs Monday Sept 25th at 6pm on OLN in Canada

Well finally, over a year after shooting, my episode is going to air on Monday! My brother Ryder and I saw a pre-release DVD yesterday, and were really happy with how it turned out!

For those who think reality TV is a sham, everything you see on the episode actually did happen. Of course a lot was cut out due to taking 2 days worth of film, and putting it into 45 minutes, but all the good parts are in there.

Hopefully everyone enjoys it!


Math calculations in Flash return wrong number with lots of decimals...

...In other words, a Floating Point Error, or so my web research says.

Apparently, in all coding languages (not just Flash), a decimal does not have an exact representation in binary. So, for example, 5.100000000000000001 is seen as close enough to 5.1. This is fine when doing other things, such as moving a Movie Clip to an x position, but if you are coding something such as a calculator when you need to display the exact number, it can be frustrating.

I found a method online that corrects this by comparing a few numbers, and estimating. Seems to do the trick in my case.


Firebug and Flash Video

I haven't officially confirmed this yet, but I think I've found the reason why my Flash Video was frequently pausing and skipping mid-stream. I thought it was just the Mac-doesn't-like-Flash-Video thing, but I think it was actually mostly due to Firebug. After disabling it, video seemed to work much better.


X and Y positions inaccurate after startDrag with boundaries set.

Working with a recent project, I had to create a pseudo swipe on a nav bar button (CS5 was not available). So I put a listener on the button which would detect the MOUSE_DOWN and MOUSE_UP positions, and compare the difference of the mouse x/y positions to see if there was a swipe. Because the button was within a nav bar that had to be scrolled, the button had a startDrag() attached to it so it could move up and down while detecting if there was a left/right swipe.

However, once I added that startDrag() method, the x and y co-ordinates started giving me inaccurate results. If you try the following code, you will see that the x/y positions traced are exactly the same at the start and end of the click, even if myBox has been dragged 100 pixels.

import flash.events.MouseEvent;

var myBox:Sprite = this.getChildByName("myBox") as Sprite;
myBox.addEventListener(MouseEvent.MOUSE_DOWN, boxDownHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, boxUpHandler, false, 0, true);

function boxDownHandler($evt:MouseEvent):void{
	myBox.startDrag(false, new Rectangle(0,100,0,100));
	trace("STARTING MOUSE POS:", stage.mouseX, myBox.mouseY);
}

function boxUpHandler($evt:MouseEvent):void{
	myBox.stopDrag();

	trace("ENDING MOUSE POS:", stage.mouseX, myBox.mouseY)
}

I never figured out why it wasn't allowing me to get the x/y positions of the mouse, considering it was independent of the clip being dragged. However, I found a workaround. If you simply get the mouseX and mouseY position while the box is being moved, and ignore the result at the end, it gives you accurate results that you can use.

import flash.events.MouseEvent;

var myBox:Sprite = this.getChildByName("myBox") as Sprite;
myBox.addEventListener(MouseEvent.MOUSE_DOWN, boxDownHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, boxUpHandler, false, 0, true);

function boxDownHandler($evt:MouseEvent):void{
	myBox.startDrag(false, new Rectangle(0,100,0,100));
	trace("STARTING MOUSE POS:", stage.mouseX, myBox.mouseY);
	myBox.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, false, 0, true);
}

function boxUpHandler($evt:MouseEvent):void{
	myBox.stopDrag();
	myBox.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
	trace("ENDING MOUSE POS:", stage.mouseX, myBox.mouseY)
}

function mouseMoveHandler($evt:MouseEvent):void{
	trace("MOVING MOUSE POS:", stage.mouseX, myBox.mouseY)
}

TweenMax does loading

Haven't tried it out yet, but it will be in my next project. Greensock is now taking on loading with
LoaderMax. Number of features seems to overtake my usual BulkLoader, and he usually dishes out good stuff. So I'm looking forward to giving it a go.


Flash CS5 exporting causing "Error opening URL" error

I recently upgraded to CS5. Maybe that as a stupid thing to do before the first upgrade was released... As usual, there are a list of bugs. One of which, it turns out, does not allow me to work.

When exporting any FLA, including a brand new one with no code whatsoever, I get an "Error opening URL" error. It seems Flash is trying to find the SWF I am trying to export, and is getting lost.

After deleting my preferences, reinstalling, checking forums, and all the other regular things you do to fix a bug, I gave Adobe Support a call. After an hour of getting to the right person, trying to explain to him the problem, and setting up screen sharing, it turns out File Vault needs to be turned off in order to export a SWF. I tested this by creating a new user account, and everything worked fine. It also fixed the issue with Dreamweaver CS5 not opening at all.

I can't go without security, so looks like I will have to use CS4 until Adobe comes out with a fix.

Hard to believe Adobe wouldn't have tested this before releasing.

---UPDATE
Adobe seems to have fixed this. See blog post for more info


FITC Toronto 2010

In the midst of Toronto FITC. As usual, sessions are hit or miss. So far, only one has kept my attention throughout the full hour. Last year was very good, but I fear this year is following the lines of 2008's quality.

So far, the underlying theme that I'm noticing is that there finally is a real drive towards mobile apps. Even though everyone here seems to be pushing the "other mobile platforms" so you can develop with Flash ... I'm starting to realize that I'm going to have to start learning Objective C.

I was also able to talk to a couple of the FDT Developers today - specifically Michael Plank - and I brought up my problems with FDT not being able to change the format of the method params to include a $, and also that whenever I close and re-open my class folders in the Explorer, all the sub folders that were open become closed. He seemed genuinely surprised at that one, so hopefully will be able to fix it in a future release.