Flash Input text missing I

The other day we found a bug on Canned Banners that the letter I would not show up in one of our input text fields. Very puzzling indeed because all Latin characters were embedded and we were using Arial. Looking into it further, it turned out to be an anti-aliasing issue. The text field we were using was 11pt Arial with no Ant-Aliasing. So the letter I was basically a 1 pixel line. For some reason, that made the character disappear with those specific settings. I suspect a lowercase l would also have had the same problem. Changing either the font size or the anti-aliasing or the font fixed the issue.

Trouble with image thumbnails when posting URLs on Facebook.

I recently made a single serving site for web designers that just had images of the finger cursor as a transparent PNG available to use in peoples Photoshop mockups. The only images on the site were two 20×20 pixel PNGs. When I posted the link to Facebook no images came up as thumbnails next to the link. I’m guess this was because they were too small (either in dimensions or file size, I’m not sure) to be grabbed by the Facebook image scraping script. I tried uploading a large image of a finger cursor instead, but still no good. After a little bit of googlin’ I discovered that Facebook only updates their images for a URL every 24 hours, but you can force an update by entering your URL here:

http://developers.facebook.com/tools/debug

It will also tell you what images it’s finding and give you other helpful information for any URL you are planning on posting to Facebook. Quite handy indeed.

You can also specify through code which image you want Facebook to use for a thumbnail by adding this to the head area of your html:

<meta property="og:image" content="whatever_image.png" />

roundProps error when using TweenMax

A few times in the past 3 months I’ve been getting this error when using TweenMax:

1061: Call to a possibly undefined method roundProps through a reference with static type Class.

It was perplexing the crap out of me, most recently when trying to use TweenMax in a project that previously was only using TweenNano. Turns out the solution is simple, I just downloaded the most recent version of TweenMax (duh), replaced all the files in the “com.greensock” folder and it was fixed. Just posting here in case I (or anyone else) encounter it again.

Embedding Fonts at Compile-Time in Pure AS3 Projects

Been stumbling on this issue for literally days. Will write more later on it, but see below for the blog post that ended up saving my sanity. Only one improvement would have been if the author had zipped up all the required files or provided all the code as one finished chunk so I could copy and paste it in one go, otherwise perfect. Very short simple and clear.

Tutorial (AS3): Using Fonts Embedded At Compile-Time

I finally understand Model View Controller (MVC)

Our site (CannedBanners.com) uses the MVC (Model View Controller) system. For the longest time, I had no idea what that actually meant. In fact, I’m not entirely sure I should call it a “system”, perhaps it’s an “architecture” or a “design pattern” or some other term that only adds to the confusion. I’m still not sure. But I think I finally understand what MVC is at least a little bit, thanks to this short an sweet post, Model View Controller Explained. I still have more reading to do, but here’s my explanation of that explanation:

In a web application:

  • The Model is the raw data.
  • The View is how you view the data (or interact with it).
  • The Controller is how the View connects to the Model.

So the View could be HTML/CSS code that presents the data to you on your computer screen. JavaScript and/or PHP (the Controller) might take your interactions with the View and send them to the Model (a database perhaps, like MySQL). Or put another way..

MVC is like Pizza Hut:

  • The Model is the pizza.
  • The Controller is the pizza hut employees.
  • The Views are the dining room, the take out area, the drive thru, and maybe the delivery guy.

People come for the pizza, that’s the real reason they are there (the Model). But that pizza can be delivered and ordered in a number of ways (the Views), it can be delivered to their door, picked up at the take out window, or ordered in the dining room. Working as a go between for the pizza and the ways you can order it, are the people taking your order, and cooking it up.

Simple right?

Certain fonts not showing up in Flash.

So this is silly, but it wasted about half an hour of my time trying to figure out what was going on. I imported a PSD into photoshop, but for some reason the fonts didn’t come thru properly. I tried to change it manually but the font was not available in the drop down menu. I checked Font Agent Pro (my font management software) as well as Font Book, both had the font and it was activated.

The answer? CS5 uses TLF text by default for all text fields instead of Classic Text. The problem is the font isn’t available in the drop down menu for TLF text fields only for Classic text fields. Why? I don’t know. But if you are experiencing this, change your text field to Classic instead of TLF and that might solve it.

Also, TLF text adds a lot to the file size of a SWF and does some other weird stuff too. Use with caution.

Good luck!

RollOver is different in AS3 if cursor is already over MC

So, in the process of converting a banner from AS2 to AS3, I noticed some odd behavior with some rollovers. Here is the original As2 banner for reference:

Get Adobe Flash player

After the initial animation, two buttons show up that allow you to roll over to switch to different images.

When I converted this to AS3, though, the rollover kept on retriggering itself. Basically, in AS2, the roll over event is only triggered when you roll from something else on to the target object. If your mouse is already over the object and moves, it won’t trigger the rollover.

In AS3, that is not the case. Once the button reappeared underneath the mouse, and the cursor moved just a tiny bit, the rollover event would fire. Irritating, but I found a work around.

Instead of re-enabling the button immediately after the animation completes, I instead check to see if the cursor is over the button first. If so, I add an event listener for the ROLL_OUT event, which then runs a function that adds the listener for the ROLL_OVER event. See code sample below:

function enableIt() {
// This function is run after animation completes.

btn.mouseEnabled = true;
if(btn.hitTestPoint(mouseX, mouseY)) {
// Is the cursor over the button?
// If so, listener for the ROLL_OUT first, before listening for the ROLL_OVER.
addEventListener(MouseEvent.ROLL_OUT, addRollOverListener);
} else {
// Mouse is not over the button, just enable the ROLL_OVER listener right away.
addRollOverListener();
}
}
function addRollOverListener(e:MouseEvent = null) {
btn.addEventListener(MouseEvent.ROLL_OVER, doRollOver);
}

function doRollOver(e:MouseEvent) {
trace(“button has been rolled over”);
}

Custom Events cannot be named “CLICK”

I encountered this error while trying to create a custom event for a check box UI control:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::MouseEvent@5658bdf1 to com.cannedbanners.ui.SizePanelListItemEvent.

I had created a custom event class and named one of my events “CLICK”, because that’s what the event was. For some reason, it throws the above error because it thinks your trying to force a mouse event into a custom event. I renamed it to “CLICKED” and everything was happy again.

Flash embedded character ranges glyph listing

(what an awkward title for this post)

Flash, as you probably know, allows you to embed certain character ranges for dynamic text fields. I was curious just exactly what was in each of the ranges so I decided to just figure it out and list them here. In particular I wanted to know where certain special characters like bullet, raquo, tm, circle r, and accented characters lived and which sets I needed to embed to have access to them. One thing I learned first off, was that some sets overlap. The character sets “Uppercase”,”Lowercase”,”Numerals”, and “Punctuation” are all actually included in “Basic Latin”. I always thought each set was separate.

Here goes:

(note: I’m skipping “Uppercase”, “Lowercase”, “Numerals” because they are self explanatory and all of the non-latin alphabet sets because.. just because)

Punctuation:

!”#$%&’()*+,-./:;<=>?@[\]^_`{|}~ˆ˜–—‘’‚“”„†‡•…‰‹›€™

Basic Latin:

!”#$%&’()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Latin I:

¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ–—―‗‘’‚‛“”„†‡•…‰′″‹›‼‾⁄₣₤₧€℅ℓ№™Ω℮⅛⅜⅝⅞

Latin Extended A:

ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœ
ŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƒǺǻǼǽǾǿ–—―‗‘’‚‛“”„†‡•…‰′″‹›‼‾⁄₣₤₧€℅ℓ№™Ω℮⅛⅜⅝⅞

Latin Extended B:

ƒǺǻǼǽǾǿ–—―‗‘’‚‛“”„†‡•…‰′″‹›‼‾⁄₣₤₧€℅ℓ№™Ω℮⅛⅜⅝⅞

Latin Extended Add’l:

ẀẁẂẃẄẅỲỳ–—―‗‘’‚‛“”„†‡•…‰′″‹›‼‾⁄₣₤₧€℅ℓ№™Ω℮⅛⅜⅝⅞

“OverwriteManager is not defined” error with TweenLite/TweenMax

I got this error recently when using the TweenLite / TweenMax SWC file. Couldn’t for the life of me figure out what it was. Turns out it has to do with how you import the SWC into your FLA. If you go to File > Actionscript Settings.. > Library Path and click on your imported SWC file, then click the little letter “i” button to get to the Library Path Item Options box. Under the drop down “Link Type”, change it to “Merged into code”. I have no idea what this actually means and sometimes it’s set that way by default, but sometimes it’s not. If it’s not, you get the “OverwriteManager is not defined” error.