Shaky Flash Menu Script

June 18th, 2009 Art Frick No comments

OK, so you love the little shaky menu on the experiments page?  Well, for a step by step, go over to Flash My Mind.  Below is just the Action Script.  It’s commented really, REALLY well.  If you have any particular questions, feel free to ask me.

Pretty much, the buttons are made up of several movie clips, those movie clips are grouped and passed into an array.  Then we set the original coordinants and make our functions for click, over and out.  Over runs the tween stuff, out stops it and click goes to an external URL.  It’s all pretty simple really!

//Import TweenMax
import gs.*;

//This array will contain all the rectangles
var rectangles:Array = new Array();

//Loop through the items in this movie clip
for (var i:uint = 0; i < this.numChildren; i++) {

//Get an object
var object:* = this.getChildAt(i);

//Check to see if the object is a MenuRectangle
if (object is MenuRectangle) {

//Save the rectangle's coordinates (we need these later on)
object.origX = object.x;
object.origY = object.y;

//Add the rectangle to the rectangles array
rectangles.push(object);
}
}

//Add mouse listeners for the mouse area
mouseArea.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
mouseArea.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
mouseArea.addEventListener(MouseEvent.CLICK, itemClicked);

//This function is called when the cursor is over the mouse area
function mouseOverHandler(e:Event):void {

//Loop through the rectangle array
for (var i:uint = 0; i < rectangles.length; i++) {

//Assign the rectangle to a local variable
var rectangle:MenuRectangle = rectangles[i] as MenuRectangle;

//Calculate random target coordinates for the rectangle
var randomX:Number = rectangle.x + 10 * Math.cos(Math.random() * Math.PI * 2);
var randomY:Number = rectangle.y + 10 * Math.sin(Math.random() * Math.PI * 2);

//Animate the rectangle to the random coordinates
TweenMax.to(rectangle, 0.4, {x: randomX, y: randomY, alpha: 0.6, tint: Math.random() * 0xffffff});

}
//Add an ENTER_FRAME listener for the shake effect
addEventListener(Event.ENTER_FRAME, shake);
}

//This function is called when the cursor moves out of the mouse area
function mouseOutHandler(e:Event):void {

//Loop through the rectangle array
for (var i:uint = 0; i < rectangles.length; i++) {

//Assign the rectangle to a local variable
var rectangle:MenuRectangle = rectangles[i] as MenuRectangle;

//Tween the rectangle to the original position
TweenMax.to(rectangle, 0.4, {x: rectangle.origX, y: rectangle.origY, rotation: 0, alpha: 0.3, tint: 0xff8800});
}

//Remove the ENTER_FRAME listener (we don't want to shake the rectangle anymore)
removeEventListener(Event.ENTER_FRAME, shake);
}

//This function is called when the mouse area is clicked
function itemClicked(e:Event):void {

//Navigate to some URL
var urlRequest:URLRequest = new URLRequest("http://www.artfrickdesign.com/portfolio.html");
navigateToURL(urlRequest);
}

//This function is called in each frame
function shake(e:Event):void {

//Loop through the rectangles array
for (var i:uint = 0; i < rectangles.length; i++) {

//Assign the rectangle to a local variable
var rectangle:MenuRectangle = rectangles[i] as MenuRectangle;

//Rotate the rectangle a random amount (from -4 to 4)
rectangle.rotation += Math.random() * 8 - 4;

//Assign a new random position (from -4 to 4)
rectangle.x+=Math.random()*8-4;
rectangle.y+=Math.random()*8-4;
}
}

  • Google Bookmarks
  • TwitThis
  • Facebook
  • MySpace
  • LinkedIn
  • Digg
  • del.icio.us
Categories: Programming Tags:

TweenMax for Action Script 3

June 18th, 2009 Art Frick No comments

So, in the midst of continually finding new things to integrate in to Art Frick Design Flash-based projects, I’ve found this cool tweening utility that makes doing visually stimulating stuff pretty easy.

It’s called the GreenSock - TweenMax plugin for AS3. you can download it from here.

Here is what the author has to say about it:

TweenMax extends the extremely lightweight, FAST TweenLite engine, adding many useful features like pause/resume, timeScale, AS3 Event listeners, reverse(), restart(), setDestination(), yoyo, loop, rounding, and the ability to jump to any point in the tween using the “progress” property. It also activates many extra plugins by default, making it extremely full-featured. Since TweenMax extends TweenLite, it can do ANYTHING TweenLite can do plus much more.

It’s very cool. You can check out an example of it by going to the experiments page!

  • Google Bookmarks
  • TwitThis
  • Facebook
  • MySpace
  • LinkedIn
  • Digg
  • del.icio.us
Categories: Design, Programming Tags:

Cafe Pick Me Up

June 9th, 2009 Art Frick No comments

So, with my home base being 2nd avenue and 7th street, I figured that I wouldn’t get to over-zealous and stretch too far for my first review! Please feel free to let me know if you need any additional information from me to really paint a picture of any of the establishments that I’ll be venturing to!

Let me just say this place is cool. Mismatched tables and chairs, Christmas lights strung from the ceiling, and the staff is as friendly as possible. This might also be a good time to mention that this place is owned by the same couple who own “Orlogio” a cute and cheap ($7 brunch, hello!) Italian place up on 10th and A. Cafe Pick Me Up has a very relaxed and mellow vibe. No one expects you to suck down your drip and roll on out in a hurry. It has a more chill European vibe.

The crowd here is a hodgepodge of the young and unemployed pounding away on screenplays and accounting homework (don’t worry, college kids) on their laptops, and an older crowd reading newspapers and books talking about Siddartha and some Bodi Tree. While the atmosphere is AWESOME, it’s just not practical from a “work on a project for 15 hours” perspective. There is NO FREE INTERNET at this place, which is really tradgic. Being an interactive designer (where internet access is a necessity…) it’s like flipping on a kill switch.

It’s like a desert mirage, “Look water, trees, an OASIS in a dreary desert of futility!” You run to it, only to find sand…

This is the street shot, Cafe Pick Me Up is located on East 9th and Avenue A.

This is the street shot, Cafe Pick Me Up is located on East 9th and Avenue A.

This all being said, Cafe Pick Me Up is a wonderful place to sit and read and not be bothered, not so much for working. The atmosphere is contagious, the coffee is awesome, and the tea is top-notch. The whole “no free internet” thing really, REALLY leaves a bad taste in my mouth. A large iced coffee will run you about $3.

It's cool, but the "no free WiFi" sucks.

It's cool, but the "no free WiFi" sucks.

  • Google Bookmarks
  • TwitThis
  • Facebook
  • MySpace
  • LinkedIn
  • Digg
  • del.icio.us