Archive

Archive for the ‘Uncategorized’ Category

ActionScript 3.0 OOP & Design Patterns Beginner Start

startThis post is one that I can easily reference for beginners in OOP and Design Patterns when writing the posts for the Beginners Series. For many, including beginners, it may be too basic, but just in case a developer interested in taking the OOP route is unfamiliar with programming ActionScript 3.0 off the Timeline in Flash Professional or away from a Flex Project in Flash Builder, this will be a quick starting point to take the road less traveled in OOP and Design Patterns. (The instructions for getting started with Flash Builder are a bit long. However, you’ll find the instructions for getting started with Flash Pro following them.)

Starting An ActionScript 3.0 Project in Flash Builder

As far as this series is concerned, the focus will be on creating objects and design patterns in ActionScript 3.0 using an ActionScript Project in Flash Builder and adding ActionScript classes and interfaces. At some point, we may introduce some Flex features, but you’re better off getting a good Flex book and working with it.

Step 1: Open an ActionScript Project

Select File > New > ActionScript Project from the menu bar. Figure 1 shows what you will see:

Figure 1: Select ActionScirpt Project in Flash Builder

Figure 1: Select ActionScirpt Project in Flash Builder

Step 2: Name Your Project

As soon as you select ActionScript Project, a New ActionScript Project window appears. In the Project name: box type in the name of your project. Figure 2 shows that the name “BeginOOP” is used.

Figure 2: Adding a Project name

Figure 2: Adding a Project name

Step 3: Click Next (see Figure 2) and add a Client name

When you click the Next button, you’ll see the second step in creating an ActionScript project. Here is where you provide a name for the main class in the project. Since we’ll be working with design patterns, you’ll soon learn that the requesting class is named Client; so you’re likely to see “Client” used as the main project class. (See this Simple Explanation as to why the name Client is preferred.) The default name for the class is the project name; so you’ll have to change it as shown in Figure 3.
Read more…

Share
Categories: Uncategorized

ActionScript 3.0 to Screw with Your Head: Let's Meet at the Algonquin!

roundtableComfortable Minds Don’t Think

I’ve been working on a big mixed ActionScript 3.0 and HTML5 project and two different PHP projects, and as always I’m delighted to find there’s more to learn. In particular, I was going over some PHP OOP documentation and ran into some code that I thought was one thing and found out it was something else. So naturally, I thought it was a PHP idiosyncrasy. Well, it wasn’t, and I was told that similar code was found in C (back in the day…), and so I wondered what would happen in ActionScript 3.0. I made up a test and gave it a spin. Here’s what I came up with:

?View Code ACTIONSCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package
{
	import flash.display.Sprite;
 
	public class TestBench extends Sprite
	{
		public function TestBench()
		{
			var greetings:String="Hello";
			var goodbye:String="Adios";
			if (goodbye=greetings)
			{
				trace(goodbye);
			}
		}
	}
}

What’s going to happen? Before running the code, I want to assure you there are no typos. See if you can figure out what will happen and more importantly why!

Good Chats

Anywho…I’m hoping to meet as many of you who can make it to the Algonquin Hotel lounge next Thursday (January 13) at 6pm. I’ll be staying there; so I’m not too worried about getting lost on the way home. Everyone’s welcome.

In the meantime, let’s hear what you have to say about the sample code above. It’s not what you think it is.

Share
Categories: Uncategorized