Banner Ad Dev Guide Ready

Been working on a Banner Ad Development Guide for Project Managers and Designers for a bit, and finally completed it this morning. It is not about design - It is banner development from the Developers perspective, but not for the Developer. Feel free to comment and share!


CS5.5 hangs when exporting to Quicktime ("Recording Flash Content")

Recenly I had to export an FLA file to a Quicktime movie, and found that it just hung around saying "Recording Flash Content". I though this was due to the high res FLV I had embedded in the timeline. But afte waiting an hour, I realized something was wrong. I restarted the computer, tried reducing the rez on the FLV, but nothing helped. I realized that it was because there was a stop() frame on the main timeline, and the Quicktime was se to stop when the last frame was reached. Thus the last frame was never reached, and Flash went into a loop. Removing the stop() frame fixed the issue immediately


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.


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.


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.


Solution for clickTag buttons blocking underlying buttons

When doing a banner ad, I tend to code things different ways, depending on the situation. Sometimes laying out items on the timeline, sometimes adding items dynamically.

But no matter what, there is always an invisible clickTag button above it all allowing for the user to click through to the desired website.

However, a lot of the time, items below this invisible button require some sort of user interaction, such as a button which does something besides go to the website. If the invisible clickTag button is over this item, it will not register any mouse events.

This is fine if the items were added dynamically - we can just swap how they are layered on the display list so the clickTag button is below it. But if the underlying button is on the timeline, it becomes more problematic - A button under a button, or two buttons at the same time are a pain.

So I came up with a class which dynamically creates an invisible clickTag button, and allows you to add or remove items underneath it to look out for, and allow them to have user interaction.

Download PassiveClickTag (AS3)

To use, in your main class type the following code:

var bClickTag:PassiveClickTag = new PassiveClickTag(this.stage.stageWidth, this.stage.stageHeight);
bClickTag.addEventListener(PassiveClickTag.CLICK, clickHandler, false, 0, true); 
bClickTag.start();

This will set up an invisible clickTag button which calls the clickHandler() method on click.
Nothing else is needed besides the event handler itself, for example:

function clickHandler($event:Event):void { 
	  trace(_clickTag)
}

When you have a button or object below the clickTag button that needs to have MouseEvent access, type:

bClickTag.addButton( myUnderlyingItem );

And to remove, type:

bClickTag.removeButton( myUnderlyingItem ); 

Once started, an ENTER_FRAME event runs and looks through the added buttons to see if there is anything the mouse is over that needs any MouseEvents. If so, it disables the clickTag while that button is below, re-enabling it once the mouse is not over that item anymore.

Feedback is encouraged. If someone can come up with another way to do it that does not require an ENTER_FRAME, I would be interested to hear what you think.


Pointroll API classes for FDT

The Pointroll Ad Server requires an MXP extension on Flash in order to give it access to the Pointroll API. This makes things work great when working directly from Flash, but when working from FDT, it does not give access to the custom class files and methods. It also makes FDT think that calls to these methods are errors.

I was recently doing a banner ad using Pointroll, and all the so-called errors were annoying me. So I did a little research, and found where Pointroll (and, as it turns out, a bunch of other extensions) store their classes.

In case anyone else is having this issue, they are located here:

PC – C:\Documents and Settings\ [USER] \Local Settings\Application Data\Adobe\Flash CS4\en\Configuration\Classes\PointRollAPI_AS3

MAC - HD/Users/ [USER] /Library/Application Support/Adobe/Flash CS4/en/Configuration/ Classes/PointRollAPI_AS3

You can then add a Linked Library to the FDT project, so that you have access to whatever you need within the Pointroll API.


Flash vs HTML5, and the death of Flash - My own take

Anyone want an interesting read? Check out the comments on this article on Lee Brimlow's blog website.

It started off talking about the lack of Flash support of the iPhone, and quickly degraded into name calling from the Flash-Sucks side to the Flash-Rules side, and back again. While most of the arguments are truly interesting, I also found it amazing as to how passionate the debate became. Full props to Lee for being able to moderate what I'm guessing was not a fun job.

Being a Flash developer, one might think I am biased; but my take for what it's worth, is that although it is inevitable that any language, in time, will give way to more powerful languages, in regards to Flash, that is not eminent.

The arguments against Flash seem to be as follows:

- HTML5 has native Video Support so Flash is no longer needed.
True it does have Video Support. However, even if HTML5 takes over as the standard for Video playing (which is unlikely soon, as battles reminiscent of the 90's browser wars are developing over which video standard to support. Plus, open standards are notorious for taking forever to figure things out), there are still a lot of things that Flash will still be the easiest to do in, as Flash will continue to advance as the browsers fight it out about standards. Yes, you could try to build a walking AT-AT walker in CSS, or have stars dancing (Safari only) around the page using HTML5, but why would you want to? As a true OOP language, which possibly some HTML and CSS developers are afraid to learn, it is so much easier and faster to do it in AS3. Flash is simply capable of more. It isn't just about Video. Try doing any of these in HTML5...

- Flash is a processor hog
In the cases of bad development, yes that is true. But bad development in any language is a processor hog

- Flash is annoying Advertising
Yes, advertising can be annoying. But it is advertising that is the lifeblood of the internet. If Flash disappears, another technology would come along to replace the advertising. Flash right now is the best way to code those advertisements, as it is specifically designed for handling video, interactivity, animation, databases, and everything else you could need for coding and tracking Rich-Media advertisements. And I might add that Apple, despite Steve Job's recent announcement that Flash sucks (I'm paraphrasing of course), uses Flash to display it's commercials on banner ads.

The other thing I would like to mention is that there will always be arguments to use one language over another. Not just Flash vs [insert name of technology here], but in other areas as well. When things like Silverlight and Unity get more popular, Flash will not die. It simply will give a developer more options to choose from depending on the project's needs, the developer preferences, and the language advantages.

Flash is a great option for doing certain things when done right, and will be around for a while to come. .NET does not die because of PHP or Java, or vise versa. They are tools to choose from.