ActionScript 3 – What Is A Variable?

For whatever reason I feel like doing a mind dump of some ActionScript knowledge. I often struggle with what level “actionscripter” I should target, so I’ve decided on starting somewhere near the beginning. In this case I’ll discuss variables and what they’re used for. Maybe at some point I’ll put together a nice mini-book on ActionScript. Ah, the future…

What the heck is a variable?

Think of a variable as a container. A container that you can place different types of information in and recall at a future time. Whenever I try explaining a variable to newbs I always use the example of Nike iD. Are you familiar with the site? Nike iD is essentially a custom Nike shoe design shop. Anyone can go to the website, choose a stock shoe, and do all the customizing themselves. Fabric, leather, color, and shoelaces are on the table. Cool! But, from a developers perspective, this is going to require the use of variables.

When the user is done designing the shoe, the developer needs to record what colors and fabric options have been chosen. A good way to do this is with variables. The below animation serves as a good visual.

Note: the above code is not the actual code that would recreate this example. I am just using it to illustrate the changing of the variable shoeColor. You’ll notice that when a color is chosen that the hex value of the variable changes.

The theory here is that we are saving the color of the shoe that the user has chosen to a variable, or container, called shoeColor. This way when the order for the shoe needs to be shot off to accounting and order fulfillment, everyone knows what color the shoe is supposed to be. Hopefully that makes sense.

Declaring variables

Hopefully you now understand the basics of what a variable is. Now let’s spend some time looking at how they are actually declared. In AS3 there are a few rules you have to follow when creating a new variable. First, they are only alphanumeric, but will accept underscore (_) or the dollar sign ($). If you’re coming over from PHP you’ll probably be accustomed to using the dollar sign with variables. Secondly, AS3 variables can only be one word, and should not start with a number. Lastly, variables are case sensitive, so myVariable is different from MyVariable.

Another important thing to understand about variables is the idea of data types. As ActionScript has progressed as a language it has become more strict with the handling of data types. What is a data type you ask? A data type is a way of defining the type of variable you are working with. In our above example the data type was dealing with color. We can also deal with strings (or text), numbers, arrays, etc. Here is a quick table for your reference:

Data Type Example Description
String “my name is Matt” A string of characters
Number 7.3 Any number, can include decimals
int -3 Any integer or whole number
uint 2 Unsigned integer or any non-negative whole number
Boolean true True of False
Array [1, 3, 5] A series of values in a single variable
Object sampleObject Essentially a custom form to store multipe values

With the above table you are now ready to see the syntax for actually declaring the variable. Below are a few examples of variable declarations:

   var myString:String = new String();
   myString = "This is probably the best string ever written.";

   var myNumber:Number = new Number();
   myNumber = 17;

   var myArray:Array = new Array();
   myArray = [2, 5, 6, 7];

Hopefully this has clued you in to variables in ActionScript 3. You’ll want to get very comfortable with the concept of variables as you’ll use them in nearly everything you do. Feel free to ask any questions if I’ve left things hazy at all. I’m off to Home Depot to buy some spray paint and masking tape for a little art project on my ski helmet. Peace.

Posted in Flash/ActionScript, Web Development | Tagged , , | Leave a comment

Myles Kennedy Wallpaper

Calling all Alter Bridge fans. This is, in many ways, a first attempt at a one-layer Photoshop painting. Myles Kennedy, the lead singer of Alter Bridge, was my subject. I restricted myself to only one layer, aside from the importing of the Alter Bridge Logo, to simulate a real world painting. The process tought me many things, and I look forward to my next painting.

 

 

Myles Kennedy

The most difficult part, in my opinion, was getting a good skin texture. I went through what seemed like a hundred different brushes before getting something I was okay with. I could spend a hundred more hours on this before considering it complete, but it is at a point where I thought people would like to see it.

The image below fits my 30″ cinema display and can therefore be resized down to fit whatever your on. If someone needs help resizing let me know in the comments and I’ll get them a better size.

Posted in Freebs, Misc., Wallpaper | Tagged , , | 3 Comments

Five Great CSS Inspiration Sites

So every design site has a few lists. So, in order to make sure I contribute to this zany trend I’ll go ahead and provide a list of my own. I could probably list 30 CSS sites that I visit on a regular basis, but by the time you get to site 8 or 9 you’ve probably moved on. So I’m going to give you five really good sites that are a few of the sites I hit up first when trying to break my creative blocks. Here we go.

1. CSS Remix

CSS Remix

I’d consider this a pretty well known site, but a good resource none-the-less. Sites are user submitted offer a nice range of styles.

2. BestWebGallery

BestWebGallery

A site run by Nik La, who has a couple really nice sites, and whom I’ve been following for some time. Another good collection.

3. CSS Moon

CSS Moon

A cool “coverflow” look in the header. A lot of the sites here seem to have a younger feel to them. Younger in a good way that is.

4. FWA

FWA

A little more than your average css design blog. Been around for some time and has become quite robust. A must see.

5. CSS Nature

CSS Nature

As designers we have a lot to learn from nature itself. Thus by association we can probably learn from sites that make use of these such themes. Check them out at CSS Nature.

Posted in Web Design | Tagged , , , | Leave a comment

I Love Adobe Flash CS4!

Where do I start. I guess I’ll start with the new GUI. It is fabulous. Gone are the floating palettes and accidentally clicking through to the desktop. That was probably one of my greatest frustrations in my PC-to-Mac switch some years back. It is now one connected, but fluid, interface that has six preset layouts to choose from. Each layout caters to a slightly different audience, and I quite frankly will probably use two or three of them on a regular basis.

Here is an example of the “Designer” layout:

Designer Layout

I love having the properties palette along the left like the above picture. In a way it feels a bit more life After Effects, which I don’t think is a bad thing. I will probably be in “Developer” view the majority of the time and it has a nice layout as well. It puts less emphasis on the tools, and removes the timeline all together. Removing the timeline was a no-brainer.

Another improvement to the interface seems to be a fix to the bug in the tabs. I’m sure others noticed the frozen tabs that sometimes occurred after you compiled and then came back and tried to click on a different tab. I would always have to click on the top of the app and then click the tab to actually get it to come to the front. Glad to see the bug fixed.

Users will also notice a greater refresh speed when moving and resizing things on the stage. I can really whip around symbols and it feels remarkably lifelike. Screen updates seem to take no time at all. (I admit I’m on a screaming graphics card though). But, they weren’t lying in their announcement webcast that it’s fast!

I don’t know how to explain it, but it just feels like Flash has been put together better this time around. It’s like CS3 was a lite version and CS4 is the professional one. The icons, buttons, scrollbars are all so much crisper and easier to navigate. It’s really awesome.

3D

This is obviously one of the eye-candy upgrades that people were looking for. I haven’t put the 3D through its paces yet, but it certainly opens up a new realm of possibilities. The rotation feel is not unline Maya in its smooth feel. This is certainly a relief as I hate tumpling around objects with a clunky 3D program.

Aside from the obious rotational aspects of the 3D feature it also has perspective angle camera. This should help in creating a more believable environment and was more than I was expecting in the first release. It’s safe to say that you will see an explosion of 3D effects, both good and bad, in the coming months.

Settings

One of the first things I noticed when setting up was the new Advanced Settings dialogue box. You’ll notice that is a bit of an upgrade and allows for more customization. This will probably be welcome to the hard core coders or people working on larger projects and/or teams. Here’s a screen shot:

AS3 Advanced Settings

Under the Drawing section there is a new “IK Bone tool” option. It allows you to Auto Set the transformation point. Under Text there is now the option to show font preview. It’s pretty much like Illustrator. It shows you actual look of the font in addition to its name.

Bone Tool

The bone tool obviously has some very specific uses, but I can recall two projects that I’ve worked on in the past that really could have benefited from this very tool. If you’ve ever rigged a character before you’ll have no problem jumping right into Flash’s bone tool. This was another one of Flash’s new splashy features. I will definitely find myself using this in the future.

Conclusion

I’ve only been playing around for an hour or so, but so far I’d rate the new Flash an A. I need more type to actually work with it before giving an in-depth review. I’d recommend downloading the trial and playing with it yourself. I was quite sceptical of this whole CS4 release, because I didn’t know what was going to be all that great about it. So far it’s pretty amazing.

Posted in Computers, Flash/ActionScript | Tagged , , | 4 Comments

Adobe Creative Suite 4 – “Order Now”

It’s here! They’re claiming its the shortcut to brilliant and you can now fork over your hard earned money to get the new version. In their words, “Brilliant is rarely born. Far more often, it is made. And even then, only after you’ve pushed it over and over. That’s all part of the creative process. It’s why you need the power of Adobe Creative Suite 4 to work faster and explore new possibilities.”

Order Now. Yay!

Apparently, you can’t get through to buy it on the site. So, if you have to have it now. Here’s my link: https://store1.adobe.com/cfusion/store/index.cfm?store=OLS-US&view=ols_cat&catType=CSSUITES&catID=CSSUITES&trackingid=DNSHG&nr=0

Posted in Industry News | Leave a comment

Smooth Camera Movement in After Effects

Let’s face it. Swooping camera movements in After Effects can be a real pain if you are just using the camera itself. It is nearly impossible to get the point of interest and the camera to move in such a way that creates a smooth and fluid effect. Not to mention it can eat up your time faster than Rosanne eats up a buffet.

Default Camera Setup

The above picture is a typical 35mm setup. You get this by right-clicking in the layers pallet and selecting New > Camera… In our theoretical example we will pretend that we are tracking, from behind, a car that is traveling down a windy road. Initially we know that we are going to have lots of s-turns to deal with.

Car Example

The camera setup we have right now requires at least two keyframes for every s-turn we make. We will have to keyframe both the camera and the point of interest to make sure that our speeding car is in the field of view. This process can take some time and rarely results in a realistic camera movement.

The Solution

Null Objects

In short, we are going to solve all of our problems using null objects. Then through the process or parenting we will create a rig that lets us do everything we want with much more ease.

First things first. Create a camera with any settings you like. You can always go back later and change them if you want to. To create a camera you need to right click in the layers palette and choose New > Camera…

The second thing you need to do is create two null objects. Doing this is similar to creating a camera, right click in the layers palette and choose New > Null Object. You’ll need to name one of these “Camera Movement” and the other “Camera Master.” Before moving on, you also want to check the 3D box to make sure these null objects are moving around in 3D space. The box looks like this:

3D Activation

At this point we’re almost done. We just need to parent things in the correct order. First, you need to parent the camera itself to “Camera Movement.” Then parent the “Camera Movement” to “Camera Master.” In a hierarchy it looks like this:

Camera Master

^

Camera Movement

^

Camera

Now, here are the rules for movement and rotation:

  • Camera Master – Reserved for last minute adjustments (camera shakes, small adjustments)
  • Camera Movement – Responsible for all major movement of the camera, sans rotation
  • Camera – Reserved just for the rotation of the camera itself.

With those rule established you should have no problem flying your camera around succesfully inside of After Effects. Gone are the days of trying to sync the position of interest and camera. It takes about 15 extra seconds to setup initially, but the results are definitely worth it. Have fun!

Posted in Motion/3D, Motion/3D, Tutorials | Tagged , , | 9 Comments

Apple Introduces New MacBook Pro

What’s better than one mouse button? No mouse buttons! Apple’s notorious refusal to add a “right-click” button to their mice has taken a turn in the opposite direction. The new MacBook Pro will, among other things, have a button-less glass trackpad complete with gestures galore.

New MacBook Pro

Major Upgrades

New Construction

The new unibody enclosures are actually carved out of a single aluminum block. Apparently this is what they had been doing with the MacBook Air’s and now they’re porting over the the technology. The new construction should be more rigid and durable, which is never a bad thing. Overall this reduces the total number of parts and thus the less things that can break.

Ultrathin Glass Display

You’d better like glossy, because you no longer have the option to go matte. I’m not exactly pumped about this. The logic is that you can adjust brightness to eliminate glare, but I’d just rather have no glare (or fingerprints). The display is LED-backlit and also claims a stronger and more durable construction. The display is also arsenic-free to follow the path to greeness.

New Graphics Card

NVIDIA is delivering the GeForce 9600M GT, which boosts performance by 2.3x. The cool thing about the new setup is the ability to switch between an integrated processor and the newer GT processor. Obviously the latter eats your battery a bit quicker.

Glass Multi-Touch Trackpad

Gestures. Gestures. Gestures. And who needs buttons? The new trackpad has up to four fingered gestures and the ability to use software enabled right-clicking. The lack of a physical button means 39% more room to caress your lappys new glass. Might be cool, but I’d need to try it.

All in all, these look like some decent improvments. I’m still waiting for a tablet. HP has been airing comercials with iMac like display that is all touch screen. I’m actually surprised they beat Apple to market on that one. Oh well. Competition is good. Now Apple has to answer.

Posted in Computers, Industry News, Misc. | Tagged , , | 3 Comments

Remove “Blog Archive” From WordPress Titles

This is just a little helpful nugget for all your WordPress fanatics out there. Assuming you’re using, or have copied over, the code from the default theme, you’ll probably notice the words “Blog Archive” as the title of your page. In my opinion, this is a poopy SEO practice and doesn’t add anything. If you were to google something you also have an additional 14 characters that will often lead to your page title being truncated. So let’s get rid of it!

The Problem

The default WordPress setup inserts the words “Blog Archive” in between your web site name and the actual blog post title.

The Answer

  1. Login into the site admin of your WordPress blog
  2. Click Design in the main nav
  3. Click Theme Editor in the secondary nav
  4. Click Header in the theme files section (right column)
  5. Find the following code and delete it:
<?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?>

That’s the gist of it. If you can’t find that big of code use your ctrl+f/command+f. That shortcut is your friend. Hopefully you’ll experience some better SEO as the remaining words in your title carry more weight.

I’m off to Eugene to watch the Ducks stomp UCLA this weekend. Be back Monday. Have a good weekend:)

Posted in Web Development, WordPress, Wordpress | Tagged , , | 2 Comments

Simple Text in Maya

There are times when you just want to whip out some simple 3D text for an animation or print ad. Nothing too fancy, but definitely more advanced that Illustrator’s 3D can handle. It probably doesn’t take a crazy big application like Maya to do it, but it happens to be what I use. Here we go.

Just to be clear, this is the easiest way of getting simple 3D text in Maya that I know of. It doesn’t involve bringing in outlines from Illustrator and then lofting or anything like that. Simple. Simple. Simple

Step 1

Starting with a new document in Maya. Go to Create > Text, but click on the sqaure that brings up the options dialouge box. This will allow you to enter in your custom text and choose from a bevy of options.

Click on the options box next to "text"

You should be in a dialogue box that looks like the following. You don’t need to copy my settings. You can put whatever you want. Just be creative.

Enter in your own values

Step 2

So far so good. Most of you have probably done this before and are thinking why am I reading this lame tutorial. Well, there is a good chance that some of you have done this before, but wanted multiple lines of text. By default, Maya will just string your text along one line. Not very useful for more than few words.

In order to break apart your letters or words you need to make sure the Polygons shelf is selected and click on the separate button. It looks like this:

Click the separate button

You now have the ability to grab, move, scale each letter individually! Easy as pie. It’s surprising how much I use this just to get some perspective in my work. Don’t bother with all other type tutorials you see on the web, unless you are wanting to get crazy detailed. If you just need some simple text, this is your answer.

Yes he does...

Now clearly you shouldn’t stop here. I haven’t rigged lights or applied textures or anything like that. Maybe I’ll do a really cool fancy type tutorial at some point. This was just meant to show the basics of getting type into Maya and moving things around.

Posted in Motion/3D, Motion/3D, Tutorials | Tagged , , | 3 Comments

Naming Your Layers in After Effects CS3

I got an email from a reader asking how to rename your layers in After Effects. It brought back bad memories of clicking around forever trying to figure this out. It seems to be one of those things that is always overlooked in teaching, because it’s “assumed” knowledge. No worries…here’s your answer.

The Problem

By default AE will show you the source name in the “Layers” palette. This is actually a good thing so be glad its there. But what happens if your source files are cryptically named and you want to change the naming convention?

The Solution

You need to click the column header titled Source Name. This will toggle your layers to reveal their Layer Names. All you need to do at this point is click on the layer name you would like to change and press enter/return. This will allow you to edit the field. No sweat!

Easiest. Tutorial. Ever.

Posted in Motion/3D, Motion/3D, Tutorials | Tagged , , | 2 Comments