Free 3rd Party Tools to Make Your Life Easier in Flash (and Elsewhere)
Tuesday, August 21st, 2007Here’s the second of my Notes on Design guest blog entries.
Here’s the second of my Notes on Design guest blog entries.
I was helping a friend the other day with a rounding issue. He needed to round numbers not to the nearest integer, but to the nearest hundred. So 52.3 would round to 100. 86 would round to 100 as well. 13 would round to 0 and 101.287 would round to 100. You get the idea. The Math.round() method doesn’t take any parameters except the to-be-rounded value itself, so how could this be accomplished? The answer couldn’t be simpler. Keep reading »
I was just gabbing with someone about the NetStream class, which nudged my mind toward the VideoPlayer class. According to the Components Language Reference, the FLVPlayback class “extends the MovieClip class and wraps a VideoPlayer object.” As it turns out, the VideoPlayer class is mentioned in the Components Langauge Reference, but if you dig into it, you’ll quickly discover that none of the class members is hyperlinked. In other words, you’ll get an overview of the properties, methods, and events defined by that class, but no actual explanation.
I find that an odd omission — but Adobe does make the full API available. Keep reading »
Depending on my mood, I may precede certain variable names with a small prefix that describes the type of object they point to. For example, I may give a movie clip the instance name mcBall, rather than just ball. Why? Well, it allows me to see at a glance that I’m dealing with a MovieClip instance, which can come in handy during coding and also while I’m poking through the Debugger panel. It doesn’t have any measurable effect on the functionality of the variable … it’s just one of those things you get used to. I certainly don’t always adhere to this convention, but when I do, I’m practicing something called Hungarian notation, which has a decent pedigree (at least, in computer years).
Flash provides at least one naming convention that actually can make a practical difference, if you follow the suggested suffixes in the “About using suffixes to trigger code hints” section of Learning ActionScript 2.0 in Flash. I’m not especially a fan stylistically, but, for example, if I name that ball clip ball_mc, I’ll get automatic code hinting for the MovieClip class (and so will you) in ActionScript 1.0 and 2.0. A full list of suffixes is listed in that section. Code hinting is definitely a useful tool, because I’m not always familiar with the class members of the object at hand.
What if you don’t like suffixes? Or prefixes, for that matter? Well, if you use AS2’s strong typing syntax (the :Number in something like var total:Number = 5;), it doesn’t matter what you name your variable: you’ll get code hinting if you want it (see File > Preferences > ActionScript). That’s fine for everything but movie clip instance names, which aren’t necessarily declared as variables. But … see, if you declare instance names anyway — even though you don’t need to — you get the benefit of code hinting regardless of the instance name.
With a simple line like this …
var ball:MovieClip;
… even though you haven’t set that instance to anything, you’ll get MovieClip-centric code hints for subsequent references to that instance name in your code.
When working through trig functions in articles such as “How to Constrain Dragging to a Circle,” I often find myself having to convert degrees into radians and vice versa. The formulas are truly simple … but they’re so similar, I often confuse them. For the record:
radians = degrees * (pi / 180)
degrees = radians * (180 / pi)
However, in a pinch, just use Google. Type, for example, “90 degrees in radians” (without quotes) into the search field and bingo! instant conversion.
I just finished a Flash movie that loads PNGs from a particular site folder. In this case, the list of desired files is determined by an Array instance. There are fifty-three files in this folder, and I didn’t relish typing out the names of each file by hand. Old DOS trick to the rescue! Keep reading »
It makes no difference if you’re laying out HTML, a word processing document, or even an image with lots of text. If you need filler content, just so you can visualize the layout, give Lorem Ipsum a shot. I use this site all the time. It’s free.
I’m a fan of keyboard shortcuts. Not a raving fan — I certainly don’t know ’em all
— but a fairly large number of shortcuts have engrained themselves deeply in my brain, and I happily use them without giving the action a second thought. One of these shortcuts toggles case in MS Word; that is, it changes “something like this” to “Something Like This” to “SOMETHING LIKE THIS” very quickly, without any retyping. Position the cursor in a word — or highlight a series of words, even paragraphs — and press Shift+F3. It’s a good one.
This is a Quick Tip, but it’s not related to Flash or any other software. Has nothing to do with computers, in fact. This is about how to catch fruit flies — whole bunches of ’em, with barely any effort. Keep reading »
I re-discovered this tip the other day when I was setting up my new laptop. By default, shortcuts to Windows Explorer launch the app and point it to the My Documents folder. In fact, double clicking explorer.exe does the same thing. I suppose that’s fine for default behavior — I actually do like to keep a shortcut poised to open My Documents — but I also like to launch into my c: drive. Is there a quick way to do that? You betcha. Keep reading »