iD Tech Camps

Save money on camp with this special offer

Search Our Site

The World's #1 Tech Camp

iD News and Blog

Request a Brochure

You are currently browsing the archives for the Flash tag.

Summer Computer Camp Photos-of-the-Week for 7-5-09

Most of our summer camp locations are in session this week, so let’s look at some photos! This week’s theme was “Products, Hardware and Software.” We looked through the many photos on http://www.internaldrive.com/photos and are pleased to announce this week’s photo-of-the-week winners. Thanks for taking the time to take great photos and portraying what our summer camps for kids and teens are truly like!

This summer day camp student shows off his camera skills at UCLA.

Ninja versus NinjaTM at our UT Austin summer camp.

Web Design & Flash Animation with Wacom® Pen Tablets at Ohio State.

Game Modding with Warcraft® III at the Villanova Gaming Academy.

Camp activities include Apples to Apples at Rollins College.

Looking up from her Dell Computer at our Santa Clara summer camp.

Working with Adobe® Illustrator® CS4 at Sacred Heart University.

Outdoor summer camp activities at UC Irvine.

Vex® Robotics at our MIT summer camp.

Excited over his SporeTM creature at our University of Washington camp.<-->

July 9th, 2009 | Tags: , , , , , , , , , , , , , , , ,

Posted in: iD Tech Camps

Tutorial: Flash Animation for Beginners 2

April 17th, 2009 | Tags: , , , ,

Posted in: iD Tech Bloggers

Tutorial: Flash Animation for Beginners

March 27th, 2009 | Tags: , , ,

Posted in: iD Tech Bloggers, Uncategorized

Changing the default Flash cursor

Ever wanted to use a custom animated cursor in your Flash project? This video tutorial will show you how to do so via Actionscript. Click here for the source code.

March 7th, 2009 | Tags: , , , ,

Posted in: iD Tech Bloggers

WhackIt: Flash Game Video Tutorial

Here’s another Flash video tutorial. This time we’ll be focusing on a “Whack-a-mole” type Flash game. Click here to download the accompanying source code.

March 4th, 2009 | Tags: , , , ,

Posted in: iD Tech Bloggers

Video Tutorial: Creating a Defender Flash Game

I’ve created a video tutorial breaking down in 10 minutes how to make a Flash defender game. If you’d like to check out the game and source, they are also available.

Play the game: http://forum.internaldrive.com/files/vlog/Yadder.swf
Download the source: http://forum.internaldrive.com/files/vlog/VLog1Yadder_src.zip



February 25th, 2009 | Tags: , , , , ,

Posted in: iD Tech Bloggers

The Ternary Operator in Flash (if-else shorthand)

Most people fluent in Flash Actionscript are familiar with unary and binary operators, but there is also a ternary operator that can be quite useful. First, a refresh on operators:

Unary: count++;

Binary: count = count * 2;

Ternary: var result:String = (count == 0) ? “Empty” : “Not Empty”);

So what does this mean? You can use the ternary form of the if statement as a shorthand. Let’s look at the equivalent full if-else statement:

var result:String;
if (count == 0) result = “Empty”;
else result = “Not Empty”;

Of course, using the ternary operator cuts down on code readability, but three lines can effectively be cut down to one. Remember, the form is this:

(condition) ? ifTrueDoThis : ifFalseDoThis;

February 9th, 2009 | Tags: , , , , , ,

Posted in: iD Tech Bloggers

Properly Referencing Your Main Class in Flash Actionscript

For those of you moving from Actionscript 2 to 3 (with a heavier focus on proper object-oriented principles), you may find that accessing your Main class and Stage isn’t as straight-forward. In this post we’ll highlight organizing your classes to properly reference your main class. First, let’s take a look at our Main class:

package {
    import flash.display.Stage;
    import flash.display.MovieClip;
    public class Main extends MovieClip {
        private static var _instance:Main = null;
        public function Main() {
            _instance = this;
        }
        public static function getInstance():Main { return _instance; }
        public static function getStage():Stage { return getInstance().stage; }
    }
}

First we define a static variable, _instance, to hold a static reference to Main. We are assuming throughout this that we will use Main statically. In other words, there will only be a single instance of our Main class. Next, in our constructor, we use the line _instance = this; to set our static version of Main to the one that is created when the constructor is called.

We will use two methods to get access to Main and the main stage. First, getInstace() is a static function that always returns a copy of _instance. If you want the stage instead, use getStage(). All getStage() does differently from getInstance() is return the stage property of _instance rather than the object itself. Using this format simplifies your code in other classes.

Now let’s say you want to use these functions in other classes to add something to the stage. Let’s pretend we have a Tree class that needs to add itself to the main stage when it is created. You could use this code:

package {
    import flash.display.Sprite;</code>

    public class Tree extends Sprite {
        Main.getStage().addChild(this);

        x = Math.random() * Main.getStage().stageWidth;
        y = Math.random() * Main.getStage().stageWidth;
    }
}

You can see that we can easily get properties of the stage (stageWidth and stageHeight) simply by statically referencing Main. Note that we could have used the following lines instead:

x = Math.random() * Main.getInstance().stage.stageWidth;
y = Math.random() * Main.getInstance().stage.stageWidth;

It really just depends on which example you find more elegant. One additional benefit of using the techniques described here is that you can use the getInstance() to determine if Main has loaded. Simply do:

if (Main.getInstance() != null) { /* some function */ }

Hope that gives you an easy framework for accessing your stage and Main class in AS3!

December 19th, 2008 | Tags: , , , , ,

Posted in: iD Tech Bloggers

Blog Categories

ACCED-I Meeting Exelence On CampusThe World's Best Summer Camps

Blog Archives

CEO's Blog

Tech Bloggers