TextField.onSetFocus and onKillFocus weirdness

I had to make a quick form using ActionScript 2 today. I wanted to add a quick little feature where the default “filler” text would be wiped out when someone clicks on the text field to start editing. Also, if the user left the text field without typing anything, the “filler” text would come back.

Simple stuff. And the code goes like this:

1
2
3
4
5
6
7
8
9
10
11
var startTextFirstName:String = "First Name";
 
tfFirstName.onSetFocus = function (obj:Object)
{
	if (tfFirstName.text == startTextFirstName) tfFirstName.text = "";
}
 
tfFirstName.onKillFocus = function (obj:Object)
{
	if (tfFirstName.text == "") tfFirstName.text = startTextFirstName;
}

I did that for three text fields. But it only worked for one of them. Weird.

Turns out the fix was simple. I had the uncooperative text fields set as MULTILINE input text fields. Change them to SINGLE LINE fields and all was well.

Posted in Uncategorized | Leave a comment

Star Wars titles with CSS

Check it out.

My thoughts? Cool. Except that the fonts look like crap. And it really looks like crap as it crawls off into the distance. And, as he said, “It only works in Snow Leopard in Safari 4.0.4 and the WebKit nightly.”

I should point out that I don’t think I have the WebKit nightly installed, but it still mostly worked for me. Maybe it would look a little better with the nightly? I’m not likely to try. It’s not news when you can create an effect in a web browser that way, way, WAY less than 1% of viewers can see.

So, once again, wake me up in ten years when these “standards” actually have something resembling a standard implementation.

Note: I’m not putting down Guillermo at all. It’s just that designers and developers have a long, long time to wait to be able to reliably and easily do things that have been done with Flash for 5-10 years.

Posted in Uncategorized | Leave a comment

Gordon – Open source Flash runtime written in JavaScript

Check out the demos.

Does it do anything besides play back linear animation? If not, WHO THE FUCK CARES?!

Posted in Uncategorized | Leave a comment

Loading in local external assets into an Air app

I’ve recently been tasked with turning an existing Flash app (that is to say, a self contained Windows EXE/Mac App) into an Air app. The original was only meant to run locally. It was never meant to be hosted on a web server. This module depends on loading in lots of external XML docs and images when you navigate to different sections. When loading in an XML doc, the code looks something like this:

1
2
3
4
5
6
7
8
9
10
// make the URLLoader that'll load in XML doc
var _l:URLLoader = new URLLoader(new URLRequest(_url));
 
// add a listener to use when the XML doc has loaded
// The xmlLoaded() method actually creates the XML object
_l.addEventListener(Event.COMPLETE, xmlLoaded)
 
// load in an XML doc named "myxml.xml" located in the
// "swf_assets" folder that's next to the SWF
_l.load(new URLRequest("swf_assets/myxml.xml"))

That should look familiar to you if you’ve loaded in an external XML doc before. But this doesn’t work with an Air app. Why? You don’t package external files with an Air app like you do with a SWF. So you need to handle finding external files differently with Air. It goes a little something like this:

1
2
3
4
5
6
7
// the File object is used to find the location of the
// XML doc we want to load in
var file:File = File.documentsDirectory.resolvePath("air_app_assets/myxml.xml"); 
 
// Pass the file.url property to the URLRequest constructor
var _l:URLLoader = new URLLoader(new URLRequest(file.url));
_l.addEventListener(Event.COMPLETE, xmlLoaded)

What that File.documentsDirectory.resolvePath business is doing is telling the Air app to go to the computer’s Documents directory, then dig into the “air_app_assets” folder to find the “myxml.xml” doc. The key here is that Air will know where the Documents folder is. It’s different on OS X vs. Windows vs. Linux. We just need to make sure that the “air_app_assets” folder lives in the Documents folder.

This isn’t an ideal solution. Had I known that this SWF was going to turn into an Air app, I would have set things up a lot differently. But at this point it’s not worth the trouble to deal with turning a TON of XML docs into a database.

The same principles used above will work for loading external images into your Air app. The key remains using the File class to tell Air where to find the files you want to load in. We can’t just pass in folder and file names when creating new URLRequest instances.

It took way too long to figure this out. I originally found a more complicated way to do this. It went like this:

1
2
3
4
5
6
7
8
9
10
11
// Same as before...
var file:File = File.documentsDirectory.resolvePath("air_app_assets/myxml.xml"); 
 
// We're going to use a FileStream object to load in the XML doc
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.READ);
 
// Use the FileStream.readUTFBytes() method to write the myxml.xml data
// directly to a new XML object
var _xml:XML = new XML(fileStream.readUTFBytes(fileStream.bytesAvailable)); 
fileStream.close();

That worked and I thought it was the only way to handle loading in external assets that lived on the user’s hard drive. But that’s messier and I like the first method better.

I’m new to this Air thing. Maybe method two is better. I really don’t know. If someone has a real answer and can explain it, I’d love to hear!

Posted in ActionScript, Adobe Air, Flash | 3 Comments

Getting text notes out of Evernote WITHOUT losing text formatting

I’m in the middle of a project. I’m looking at my notes in Evernote and if a note can be saved as plain old text, then I’m pulling it out of Evernote and dumping it into Notational Velocity. NV is awesome. Ignore its ugly icon — are the letters made out of Jell-O? — and start using it. It has the option to save your notes as plain text files in a file folder of your choice. That’s what I’m doing. No rich text. No formatted HTML. Just plain old .txt files saved to my hard drive like normal files. Not like normal files, they are normal files. If I want, I can open those files in pretty much any program since pretty much everything on the face of the planet can read plain text files. NV is also fast and lightweight and has useful keyboard shortcuts. It’s frictionless.

I’m getting sidetracked. This post isn’t supposed to be about how awesome Notational Velocity is. But it is awesome.

The Problem

Have you ever copied a nicely formatted text note from Evernote only to find that when you paste it someplace it loses all of its formatting? I mean, you even lose the hard line breaks! Carriage returns are lost and you end up with one very long paragraph. Ugh. I’ve certainly run into that problem a lot. It doesn’t happen with all of my text notes. And I have no idea what causes it or what would prevent it. If you do, please share. (This post might explain it) The good news is that, I have a way to copy from Evernote and keep the formatting

The Solution

Use TextMate.

Install the “Edit in TextMate” input manager.

Select the Evernote note’s text.

Invoke the Edit > Edit in TextMate command.

Voilà! The note should open in TextMate with tabs and returns intact. You can then copy from TextMate and paste it wherever you want. Simple as that.

I’m sure there are other similar ways to do this. Is there an Edit in BBEdit input manager? If so, I’d bet it would work as well.

As a final note, for some reason the really snazzy QuickCursor program from Hog Bay Software doesn’t work with Evernote. Maybe Evernote needs to be 64-bit for it to work with QuickCursor? I say that because the Edit in TextMate command doesn’t work in newfangled 64-bit apps in Snow Leopard.

A final, final note. I’m afraid that if I install an Evernote update, it’s going to cause this to stop working :-/

The End.

Posted in Uncategorized | 3 Comments

Apple Magic Mouse and USB Overdrive don’t mix

I just got myself a Magic Mouse since my not-so-old Logitech VX Nano started getting super flaky on me. It’s nice. I’ll probably keep it. But I’ve realized that I’m usually just as effective using the trackpad on my MBP. Plus the gestures work better (or I should say that they are easier to use) on my trackpad.

Anyway.

The point of this post is to say that you need to uninstall USB Overdrive for the new Wireless Mouse Software Update to take its place in the System Preferences. It took me a few reboots to figure that out. Now all is right with the world.

Posted in Mac | 1 Comment

Flash-like effects without Flash, might suck.

The Macheist nanobundle is up, and the site has some Flash-like elements created without Flash. When viewed in Safari 4 on my Mac, everything probably looks as intended. But there are some issues with trying to create these eye-candy effects without Flash.

  • It causes some noticeable lag in the browser. These pieces of eye candy would be no sweat for Flash, but it’s causing Safari to run a little slow, especially when scrolling on the page.
  • This because it’s really, REALLY hogging the CPU. And what for? A scroller that shows what people are saying about Macheist on Twitter. And a subtle pulsing glow under the selected product.
  • The initial draw-in effect, where these dish covers are pulled off of the products only shows in Safari, not Firefox. I’m not going to test in Opera. And I’m sure they don’t care how it looks on Windows browsers. And that effect kills the CPU and doesn’t look very smooth.

Look, if you want to do eye-candy stuff, just use Flash. It’s better in every way for this kind of thing. If you hate Flash, why try to mimic what it can do if you are going to come up way short? I’m sure the development time to make this was considerably longer than if it had been done in Flash, too. I really don’t get it.

As an added bonus, the play/pause/scrub controls on the pop up video player didn’t work for me.

I will say that they animated gears that show up when processing the order look very slick.

Oh, but you should grab the free bundle while you can. If only for Write Room.

Posted in Flash | Leave a comment

Cha-Ching 2 – MAJOR FAIL

So long Midnight Apps. And go to hell.

I tried to load my beta of Cha-Ching 2 but was told the beta had expired and I needed to check the site for updates. I go to the site and get the latest version. Install it. Still no good. Apparently I was already running the latest beta. Luckilly they have a blog post about the problem! But, the blog post just tells me we are screwed for a bit, until they get their shit together. I feel their pain in their iPhone app being rejected by Apple (which is a whole different issue that has nothing to do with Midnight Apps), but to claim they can’t just roll out a new version of beta 99 with a different expiration date because of hard drive failures and faulty backups?! That doesn’t fly these days. Do they not use a version control system? Do they not have offsite backups? Do they not use something like Dropbox to backup their data? Sorry, guys. But if you can’t be trusted to make backups of data, you can’t be trusted to make financial software! Period. End of story.

So now I need to get my data out of Cha-Ching, somehow, and find a new home for it. Any suggestions?

[If you roll back the system date to the 29th, you can open Cha-Ching 2 and export all of your accounts to CSV files. Then set your date back and you should be good to go. It looked like setting the date back caused Dropbox to stop syncing, so I'd quit Dropbox before doing that just to be safe. And to be really safe, I'd close every app possible before rolling the clock back. Who really knows what kind of havoc that can create. However I do appear to be in the clear now.]

Posted in Mac | 4 Comments

Snow Leopard, Adobe, Fonts, PostScript Type 1, Helvetica Neue, and all things related

It started with me trying to use an PostScript Type 1 version of Helevetica Neue in place of the OS X version of Helvetica Neue. I won’t get into why I was doing this, but it’s a common problem that a lot of people have dealt with for years. Part of that process involves removing the Mac Helvetica from a couple of System folders, one of which is buried very deeply in folder after folder after folder.

The good news is that I was able to use the version of Helvetica Neue I wanted without too much trouble.

Then things got weird.

It seemed like Flash didn’t see Helvetica Neue at all anymore. Not good. Then I started to realize that NO Type 1 fonts were showing up in Flash. So after some investigating I found that Snow Leopard doesn’t support Type 1 fonts. At least according to many people on the Interwebs. But that really didn’t make sense because Font Book showed the fonts just fine. And programs like Text Edit and Pages worked fine* with the Type 1 fonts.

Then I learned that there was some new weird issues that cropped up with CS4 apps and Snow Leopard. Fonts weren’t working right (duh) and a lot of people gave up and went back to Leopard.

Seeing as how I could no longer work on my biggest current Flash project because a critical font, TheSans, wasn’t showing up in Flash, I thought I was going to have to revert to a backup of Snow Leopard or maybe even go back to Leopard.

And that’s about the time I noticed that even my True Type pixel fonts from Fonts For Flash weren’t showing up in Flash. WTF?! My font list was a lot shorter than it used to be. I had no idea what fonts were missing, but I was getting a little scared. And a lot pissed at myself because the thing that started this string of events, trying to get my big family of Type 1 Helvetica Neue to work, was just me messing around. I didn’t really need the full version of Helvetica Neue. I had decided I was going to use Futura for my new website anyway.

But before I gave up, I decided to try FontExplorer X Pro to see if that would fix things. The good people of the Internet said Font Book sucked and I should try a real font management app. Okay. Sure. Err… no good. Seems like it’s not ready for 10.6 because every time I tried to activate some fonts, it just hung and hung and displayed a colorful spinning beach ball.

Time to fix things. Let’s start by putting the Mac version of Helvetica Neue back in its deeply hidden folder and the System/Library/Fonts/ folder. Reboot. Things work fine. What? Yes, all of my fonts are back in Flash. Everything works great. In fact, even the 3rd party Helvetica Neue works in Flash.

Still, there are some mysteries left unsolved:

  • Some faces, like 25 Ultra Light, don’t show up in Font Book, even though they are in the /Library/Fonts/ folder. And those fonts show up fine in Illustrator and Photoshop.
  • Those same faces that don’t show up in Font Book also don’t show up in Flash. And although I see the TrueType version of Helvetica Neue in Flash, it won’t let me actually select it.
  • The list of Helvetica Neue faces in Pages is identical to that in Font Book, as I would expect. So I can use either True Type or Type 1, but some of the faces, like 25 Ultra Light don’t show up.

I don’t understand it all. All I know is that restoring the system version of Helvetica Neue to its correct places in the System folders seemed to fix the major issues I had caused by removing it. And, really, that’s pretty much the only thing I wanted to share in this blog post.

∗ Some people say that the kerning or spacing is different in Snow Leopard. That might be the case. I didn’t do side by side testing; I was just checking to make sure that the fonts showed up I could use them.

Posted in Mac | Leave a comment

Screencast: How to hide the Dropbox menu bar icon

Get the blank icons. You’ll need this ZIP to make the Dropbox icon vanish.

Get the originals so you can undo things. This is a copy of the icons you are about to overwrite.

The idea is simple. Replace the icons that Dropbox uses in the menu bar with some blank images. The video explains exactly how to do it.

Oh, and I should mention that this little video was pretty much created for minimalmac.com. I actually like to keep my Dropbox icon visible ;)

Posted in Uncategorized | 14 Comments
  • Categories