Tuesday, February 14, 2012
MovieClip Buttons in AS3
Note to self: When using Flash's ability to make a MovieClip a button by adding frame labels _up, _down, and _over remember to set both buttonMode=true and mouseChildren=false. Somehow I always forget the latter! Throw in the useCursorHand=true for good measure.
Tuesday, December 06, 2011
Playing with Processing
I've been fascinated with Processing lately. So I decided to port a small part of my terrain generation code from my Strategy Games in AS3 series. I was surprised at how easy it was to port and how fast it runs. An unexpected benefit, I found that rethinking a problem by writing it in a different language gave me better insight into the problem I was originally solving.
Tuesday, November 22, 2011
State Machines

- 5 hours
- Learn to master state machines in part 3 of the Strategy Games in AS3 series. Attach A* to sprites to move them across terrains, bringing together the two previous parts of this series.
- Create a shaded terrain.
- Dynamically adjust contrast with the ColorMatixFilter class.
- Create multiple states for an object.
- Progress from a simple switch statement to object-oritented states.
- Create multiple players.
- Learn to create a turn-based environment for units and players, for both human and computer input.
- Create computer opponents.
- Create multiple unit types: land, air, computer and human.
- Use the bitmap class to create a “fog of war” that reveals the map as units move.
- Differentiate between turn-based and non-turn-based states (and support both).
- Add combat between units.
- Refactor to use a singleton design pattern.
You can also get a bundle of all three courses, 10 hours of training:
- Terrains
- A* Pathfinding
- State Machines
Wednesday, November 16, 2011
Adobe releases Flex
Adobe announced they are contributing Flex to an open source company. What does that mean to Flex developers? Well, Flex has been open source for some time now (since version 3), the big difference is that Adobe will not be guiding its direction. I'm wondering how much of that means dollars.
What is Flex? It is a framework of APIs written to facilitate application development on the Flash Player. A wrapper around the Flash Player APIs.
Flex is also a term people used to refer to Flex Builder/Flash Builder. The IDE sold by Adobe to write Flex applications. It is really just Eclipse with a plug-in that Adobe developed. There are other tools (commercial and open source) to develop not just Flex applications, but also pure ActionScript applications. Adobe has never seemed to put big money into its development compared to its other tools like Illustrator and Photoshop. But then lately as I've looked at Adobe apps, it seems like outside of those two, they have not been doing anything dramatic with Dreamweaver or Flash Professional, those seem to be more in maintenance mode than any big development.
As someone who has had great experiences with an open source tool (Blender), I know that it can be done right if led by the right person. But Adobe is releasing it to a group, so who's going to lead?
The real question for me is not what is happening with Flex. It is a good framework, but frameworks come and (look at Flex 3 vs Flex 4). Nor is my question what happens with Flex Builder, anyone who's seen my AS3 videos knows I don't use it exclusively during development. My question is what are Adobe's plans for the Flash Player?
I wanted to title this post "If 3D, then death". When I saw the introduction of 3D support with Flash 11 at MAX I made a joke about Flash must be near death. 3D was introduced into Director when it was near its end. But the Flash Player is still alive and well on hundreds of millions of machines and devices.
This announcement is about something Adobe does not have a knack for, making money on a framework (who does?) and creating software development tools. Where does Adobe make its money? For the first half of its life, Adobe made its money on licensing PostScript. Is that still the case? When I first saw Flash taking over, I remarked that it was like PostScript for the web. It didn't surprise me when Adobe acquired Macromedia.
The Flash Player, it's support of AS3, and it's great set of APIs for doing very visual apps is what I really enjoy developing with. The combination of ActionScript 3 and the Flash Player APIs has been the most fun developing since Lingo's update in Director 4 back in 1994. In addition to AS3, I've used many languages, popular (Java, C#, C++, Python, JavaScript) and less popular(Prograph, Lingo, Applescript, HyperTalk). AS3 is outstanding when combined with the right tools.
Adobe showed at MAX forthcoming tablet apps that were made with Flash, so they still have a vested interest in the platform for the moment. Heck, the Flash player was all over MAX, Eclipsing other tools (no pun intended... okay, it was intended). From a developers tools standpoint, HTML5 and JavaScript is not there yet. Adobe has shown it can create a great runtime and core APIs. With tools like Flash Builder, Adobe has shown they're not the best with creating software development tools. Maybe they're better off with their core strength of creating visual tools for designers, HTML5 being just one more medium to output to.
Tuesday, September 06, 2011
Getters and Setters
I first encountered the C# way of creating getters and setters, I thought they were such a nice improvement over the Java way of creating methods to get and set data. When I moved onto ActionScript 3, I continued to use and appreciate them (as they worked similarly to C#). They facilitated development nicely, you could quickly create a class with a public member, and then refactor that member to get and set functions without breaking the code that was accessing that member. For example, say you had a member:
public var data:String;
You could re-write it:
public var _data:String;
public function get data():String { return _data; }
public function set data(value:String):void { _data = value; }
The Java way (in AS3) would be:
public var _data:String;
public function getData():String { return _data; }
public function setData(value:String):void { _data = value; }
Lately I've been more careful about how I use getters/setters for two reasons:
First, the way I've been using them more recently has been a problem. I've been putting more code than I should in the setters, code that results in other state changes for the object. Side effects make debugging fun. I know, I know, this is an easy one to fix. But I must say it is so tempting to do!
Second, an advantage of a setData() function over a set data() property is that when using an IDE like Flash Builder, when you want to find all the places you called setData(), that's easy. But when you try to find all the places where the set data() function is called, you end up seeing all the places both get and set functions are called. I'm not sure if there is an easy fix for that one. It'd be nice if Flash Builder had a preference where when you searched for references of a set function, it did not include uses of the get as well.
Sunday, March 20, 2011
Strategy Games - Pathfinding
My latest course Strategy Games - Pathfinding has been release by CartoonSmart. This is part 2 of a series (part 1 being Strategy Games - Terrains).
Monday, November 29, 2010
Strategy Games in ActionScript 3: Terrains!
Subscribe to:
Posts (Atom)