Author Archive for jboss4ed

27
Feb
09

Open Source Flash Development

My Mac is in the shop and my Vista PC is inoperable. So I’ve wiped all of my drives clean and installed Linux for home projects.

Since I’m a Flash developer, I’ve stuck with Mac and PC mainly for the Flash IDE (which crashes constantly).  But now, SWF compilers are open and free. For graphics, I’ll be using Inkscape to export SVG.

A minimalist at heart, I’m not a fan of bloated IDEs. I think the fastest way to edit code is with Vi (invented in 1976.) Or emacs if you prefer.

Here are some software links for open source Flash development:

Flex SDK – A cross-platform Command-line swf compiler written in Java

HaXe – An ECMAscript language and compiler that compiles to the Flash player and other languages

Vim AS3 and MXML Syntax File – Sweet

Free AS2 compiler - If you’re still stuck in AS2, this compiler can give even better performance than Adobe’s compiler

Apache Ant – A command-line build tool that can replace the flash project panel

Inkscape - Open alternative to Adobe Illustrator

13
Feb
09

Adobe Refresh Conference

I went to the Adobe Refresh conference in Sydney. There is some crazy stuff in the pipeline.

The theme was Flash as a platform in the browser, on the desktop, and on devices such as phones, game consoles, toasters, etc. I think they are making Flash what Java promised to be in the late 90’s: write once run anywhere. Java never really fulfilled that promise, and became bloated and complex in the process. In contrast, the Flash Player is light and the API much smaller.

The other major theme was improved workflow. They opened a magazine layout in InDesign, and with one click, exported the whole thing as a SWF. You could even turn the pages. My wife is a journalist, so she knows how hard the publishing industry has been hit. You could export the whole thing into Flash, and add shopping carts to the ad sections. You could publish as an Air file and make a desktop magazine.

PDF now supports embedded Flash files, video, 3D, and interactivity. So you can also leverage flash inside PDF and use that as an application deployment platform.

They demoed an alpha of a new product called Flash Catalyst. This tool will allow designers to create applications without any code. While I doubt it will put me out of a job, it will allow designers to do much more without my help. And since it generates Flex code, it will allow me to perform certain functions faster.

There was a lot to take in. I need to organize my notes and write another post. It’s an exciting time to be a developer; the tools and deployment options available to us at this point are insane.

21
Jul
08

Programming and Bruce Lee

Programming is like martial arts; you can learn the concepts in a relatively short period of time, but it takes a lifetime to master. I’ve mastered neither.

But I’ve come to realize that it’s counterproductive to be dogmatic about languages and platforms. It’s more useful to be able to look at a piece of code in whatever language and be able to figure out what it does.

One of Bruce Lee’s motivations in creating his own form of martial art (Jeet Kune Do) was that traditional “styles” were inflexible and not adaptable to real-life situations. He said that “the worst disease of the human mind is to be for or against.”

From that, he applied Occam’s Razor and kept what was useful, discarded what wasn’t.

Development can be viewed the same way. There are a million ways to accomplish the same goal. The art is in making things as simple as possible, but no simpler.

26
May
08

Developers, Developers, Developers

Web development is a shopping list of problems a client needs solved, then packaged into a palatable system with a bow on it.

Until bandwidth increases dramatically, there aren’t any problems I can think of that haven’t been solved. Just check out Sourceforge and search for Flaming Monkeys or Potatoes. Just as the web itself is held together by duct tape and chewing gum, objectives are achieved much the same way using preexisting parts of functionality.

The fun part is in making all of these disparate pieces operate together in a way that appears seamless. The differentiator is design… but if a developer has done his job well, his contribution is invisible to the end user.

13
May
08

Intro to Object-Oriented Programming

Steve Jobs once said that computers are a blend of art and science. Programming can be viewed as a creative discipline. Just like designers have a toolset and a process to achieve an objective, object-oriented programming encapsulates both for programmers.

In traditional programming, the universe is viewed procedurally. “Things” occur in a linear order; this happens, then this, and if this is true, do this. That’s a perfectly acceptable organizational methodology, even though it doesn’t model the real world very well.

Think of the complexity in simulating a universe in a game like Grand Theft Auto. Things do not happen in a linear fashion; there is chaos in the physical universe. A butterfly flaps its wings and causes a hurricane… but how do you model this on a computer which is essentially no smarter than a “retarded cockroach” (according to physicist Michio Kaku)?

Object-oriented programming models a virtual universe based on philosophy inspired by Aristotle and Plato. When Greek philosphers started to observe and logically pick apart the way the world seemingly “works,” they discovered commonalities amongst the “objects” in our universe. So is the basis for organizing your code in OOP.

For instance, while sitting in the park, you might observe a chihuahua running around. You might notice another dog (a golden retriever) chewing on something. How would you model this “simple” universe on a computer procedurally?


var chihuahua; // create a chihuahua

var chihuahua_size = 1;
chiuahua.run = function(){
     Write("The Chihuahua runs.")

}
var great_dane; // create a Great Dane
var great_dane_size = 50000;
great_dane.chew = function(){
     Write("The Great Dane chews something.")
}
chiuahua.run();
great_dane.chew();

But what if the chiuahua kicks the Great Dane’s ass and steals its hamburger chew-toy? And what if the Great Dane runs after the chiuahua? You’d have to go in and write new subroutines for each behaviour for each dog. That would work, but it would quickly become confusing and time-consuming if 2,000 dogs escape from the kennel and run around in our virtual-park.

Like Aristotle, in OOP we would recognize the similarities between the dogs and create a dog class. Dogs do stuff, and dogs have properties such as size, color, furriness, etc. Let’s see how this could be setup:



class Dog { // We create a base class with all the common properties and methods of dogs

var size;

var color;

var breed;
function run(breed){
     Write("The" + breed + " runs.")
}
function chew(breed){
     Write("The" + breed + " chews something.")
}
}

class Chiuahua extends Dog { // We create a new type of dog that inherits the properties of all dogs
size = 1;
color = brown;
breed = "Chiuahua";
}

We could then create more dogs that extend the dog class, and set them loose in our park by instantiating them:


Chiuahua beavis = new Chiuahua();

Great_Dane princess = new Great_Dane();
princess.chew();

beavis.chew();

princess.run();

beavis.run();

See you next week.

~Jason

15
Apr
08

Actionscript 3 Basics

While many design houses are delaying the transition for now, all roads lead to the Flash Platform as a complete development environment. Which means Flash Player 9… and more importantly, Actionscript 3.

If you find yourself questioning the drastic changes in Actionscript and Flash Player 9, there are several reasons why these changes needed to occur:

  • Your designs were limited by the speed of the old flash player. The new virtual machine (AVM2) is many times faster. To achieve this level of performance, changes in the language were a must.
  • Much of Actionscript code was throw-away code. Previous versions of Actionscript lent themselves to be constructed procedurally. This also created a tendency to rewrite the same code repetitively on subsequent projects. Code was littered throughout the timeline, making it difficult to debug.
  • Code was inconsistent. The new syntax might seem foreign at first, but when you learn it once, it’s consistent. I’ll give an example below.
  • Flexibility. You are no longer locked in to the Flash environment and plug-in. You can now develop desktop applications with Adobe Air, and choose from several development tools to build your Flash applications. These include Flex, and a free command-line compiler similar to those offered for C# and Java.
  • Competition. There are many choices for designers and developers these days, and in order for Flash to avoid obsolescence , it needed to evolve and offer new tools and deployment options. Therefore, a modern, object-oriented language was imminent.

Over the next few weeks, I’ll introduce the basics of Actionscript 3 and object-oriented programming. Let’s look at a basic line of code and break it down.

var myTextField:TextField = new TextField();

  • Var tells Flash that we’re creating a variable. A variable is just a space in memory that holds anything we want.
  • myTextField is the name of the Variable we are creating. This can be anything you want, such as textFieldsRCool, or iLikePonies.
  • :TextField is the type of variable we’re creating. In this case, it’s a TextField. It could be a movieclip, a number, or something we made up, as long as it is defined by a class (which we’ll discuss next week.)
  • new TextField This actually creates an instance of a TextField. It could be anything in Flash’s library, or even your own. We’ll learn more about this next week when we discuss classes.
  • () In these parenthesis we can pass arguments to the TextField, which can set its properties. These are empty because we’re not setting any properties now. We’re simply creating a new TextField called myTextField.
  • ; The semicolon says “This is the end of the statement,” just like it always has.

If this seems a little confusing at first, remember that once it becomes clear, it works the same way with ANYTHING you’re trying to do. Next week we’ll look at classes, and do some stuff to our new textfield.