July 25, 2002

Thunderlizard Presentation

I just taught two sessions at the Thunderlizard Web Design conference in Seattle. In the first session, I talked about Rapid Flash Application development with components, using the same source file from last week's workshop in New York. The main difference is that I covered a lot more material in Seattle because I didn't have a cold, but otherwise, the source files are the same.

In the second session, I talked a bit about OOP and Actionscript, with a focus on how to build re-usable components. I also got to walk through a Flash application using SharedObjects, and spent a few minutes describing the LocalConnection feature.

Source code for the Flash Applications and OOP Actionscript are now online. Thanks to everyone who attended the session!

Posted by samuel at 12:43 AM | Comments (23)

July 14, 2002

FF2002 NY - Download Presentation and Source Code

I've created a webpage for the presentation source code and accompanying documentation. You can now access the presentation at http://samuelwan.com/flashforward/newyork2002/.

Thanks to everyone who attended my session! Feel free to post comments or email me if you have any questions. For those who attended the session, I'd really appreciate it if you could fill out the feedback form that the Flash Forward organizers usually send out after the conference. Your feedback is really helpful to the organizers and speakers, and hopefully I'll get the chance to present again :)

Posted by samuel at 03:21 AM | Comments (47)

July 13, 2002

Flash Forward Presentation Files

Just got back from Flash Forward New York. Before I upload the presentation files tomorrow, I need to write some explanations of the code. I also need to convert the speaking notes into written documentation, as a supplement to the materials in the conference CD-ROM.

Funny thing happened at the conference... the New Riders Press booth featured several pre-print versions of our upcoming book, "OOP Actionscript". Over the past three days, all but one copy of these pre-print versions had mysteriously disappeared into the crowd of visitors. It's a great sign when people want your book so much that they can't even wait for it to hit the bookshelves :)


The conference was awesome, I had many inspiring conversations with fellow developers, and enjoyed all of the presentations. I'll post my own presentation files on this website, around noon tomorrow (Saturday). As you might have seen, most of the presentation notes were actually part of the source code, so it'll be a quick download.

-Sam

Posted by samuel at 05:50 AM | Comments (9)

July 05, 2002

Bevel Panel Components

***UPDATE: The live preview .flas are now available here***

Download Zip File (components, demos, source files, and documentation)
View Single Bevel Demo
View Double Bevel Demo
Live Preview source files

User interfaces frequently employ beveling techniques to distinguish one section of an interface from another section. Traditionally, beveling in Flash took a lot of manual labor to draw each vector rectangle. Fortunately, these two bevel panel component allows you to create beveled rectangles quickly and easily. Unlike regular vector graphics, the beveled edges of these rectangles will not distort when you resize the component. You can change the colors of the beveled panel by using the color component parameters in the property inspector. Other component parameters allow you to specify the width of the bevels, as well as invert the beveling scheme.

The component also supports several methods for manipulating the component via Actionscript. For more information and demonstrations of the component methods, check out the online demonstrations for single and double bevels. The downloadable zip file includes examples and very thorough documentation.

Thanks to Eric Jordan, virtuoso of beveled interfaces, for beta-testing the components!

Posted by samuel at 05:00 PM | Comments (116)

Local Connection

Local Connection kicks ass, and totally relieves the headache of fscommands in netscape, mac IE, and other broken browser platforms. I've created very short demo file which shows you how easily you can use local connections in less than 5 lines of code.

Source Code
View Demo
Macromedia Documentation

The most immediate implications are in Flash architecture, because local connections allow you to put swfs in different HTML frames (or even different browser windows!) and allow them to control each other, or share data back and forth. This approach is preferable to fscommand because it's more reliable, and requires less programming work.

You can download the zipped source code and HTML frameset pages here, or view the example here. Just export all the zipped contents, and double-click on the index.html page. Move your mouse around the left frame, and an identical drawing will appear in the right frame as well.

Posted by samuel at 03:58 PM | Comments (11)

Variables Revisited, Part I

This tip is probably old news to some Flash programmers, but for others, it'll hopefully clarify an often misunderstood aspect of OOP. Variables actually work differently, depending on whether you're assigning a primitive data type or an object reference. The difference is subtle, but it can cause confusion when you start passing lots of data between different parts of your code.

There are two kinds of variables: a variable containing a primitive data type (number, boolean, character), or a variable reference to an object in memory (Array, String, Object, etc.). The main difference in behavior occurs during variable assignments. If you create an object and assign it to a variable, the variable only holds a reference to the object in memory, sort of like a pointer to a house on a street. If you assign the same variable to another variable, the object doesn't duplicate itself, it merely passes a reference for the same object to the other variable. Like adding another pointer to the same house on the street. However, assigning a variable containing a primitive data type to another variable will actually clone the value to a new point in memory, like building an identical house on the same street.

Here's an example:
myArray = [1,2,3,4,5];
arrayRef = myArray;
myArray[1] = "Hello";

trace(myArray);
trace(arrayRef);

Ok, so here's what's happening: First, we create an array object in memory (RAM), and set the "myArray" variable as a reference to the array object in memory. When myArray is assigned to the variable arrayRef, it actually passes a reference to the same array object in memory. The next line of code re-defines the second element in myArray with the string value of "Hello". When this element's value changes, tracing out myArray and arrayRef will both output the same value of "1,Hello,3,4,5" because both variables refer to the same array object in memory.

But consider what would happen if we applied the same operations on primitive data types instead of objects:

A = 1;
B = A;
A = 3;

Here, the variable A receives a primitive numeric value of 1. When we assign the value of A to the variable B, B doesn't receive a reference to the same value. Instead, another space in memory (or RAM) is created to hold the number 1, which is then assigned to B. Now we have two variables pointing to two numbers in memory, which is very different from the earlier example, where two variables point to the same object in memory. In the last line of code, A=3, the first slot in your RAM, which contained 1, is now assigned a number 3. When you trace out both variables,

trace(A)
trace(B)

the traceout statements will actually output "1" and "3". References vs. cloning are the main difference in how variables handle objects and primitive data types. When you're debugging, keep in mind the possibility of an object being manipulated somewhere else, with a different variable reference.

Posted by samuel at 02:21 PM | Comments (10)

July 03, 2002

Back To School

In August, I'm going back to school!

I'll begin a full-time position on the web development team at AIUOnline. AIUOnline stands for "American Intercontinental University Online", and this e-learning school provides a complete online university system with several degree programs. I don't know how much I can reveal about their internal operations, but I can say that their accomplishments over the past two years have been mind-boggling. I somewhat expected repetitive grunt work at an e-learning company, uploading course after course. In reality, they're dealing with interesting challenges that most web design studios would never encounter. The server-side engineers are way out of my league, so I'll be learning some .Net programming (thanks to Mano for the box of VS.Net, it's going to come in handy!). I'm also going to work with some very efficient Flash designers and Authorware gurus. Toss in a semester-based development cycle, and you've got a really intruiging situation.

Last year, they had 600+ students, and now we'll be working very hard to scale the system for several thousand students in two years. Within a few months, the team's going to move into a whole new building next door, about 40 miles northwest of Chicago. I'm going to look for the Chicago MMUG this fall...

By the way, my job title says "User Interface Engineer", but that's just because they didn't really care about titles. I got to pick my title... I considered "Shaolin Actionscripter" but guessed that "User Interface Engineer" would get me a better computer :)

Ok, two posts in one day, the next one tonight will feature a new component for bevelling. I've used this component frequently on my own projects, it's really quite useful. Eric Jordan, bevelling master, generously offered to beta-test it and gave it two thumbs up. Now you too can create pixel-sharp bevels with a flick of the wrist!

Look for the bevelling component in 6 hours.

Cheers,
Sam

Posted by samuel at 07:04 PM | Comments (6)

Cold Remedies: Pre-emptive Strike

I promised to post some news on Monday, but have been fighting a cold for the past four days. In my case, colds usually start with a sore throat, work their way up your sinus cavity, and eventually turn into a blazing fever/cough that lasts for two weeks. This time, it only lasted four days thanks to Zicam Cold Remedy and some Awful Bitter Chinese Medicine from last winter. I don't mean to sound like a commercial but Zicam really works. If you've ever played army games like Age of Empires or Warcraft, then using Zicam is like a pre-emptive strike on your opponent's Barracks: neutralize the growth rate at an early stage, and the enemy is at a total disadvantage against your immune system.

...and that Chinese Medicine, man, it's so horrible that your whole mouth feels like it's shrivelling up. Viruses will die from the overwhelming shock of the bitter taste.

Posted by samuel at 06:41 PM | Comments (26)