Next version of Flash player for Linux

by Josh Tynjala

Just read the word straight from the source, Tinic Uro. The next version of Flash player to appear on Linux will be 8.5. I know your average Slashbot could care less, and thinks Flash is just an advertising devil, but I don’t doubt many others have been waiting for another release.

I think this is a good choice. I’ve heard version 7 of the player is pretty buggy, so I know I wouldn’t want to dig into that code again just to churn out our friend, the 8-ball. Tinic says that they’re compiling 8.5 with the open source compiler gcc. Between that and Eclipse, it looks like someone’s a big open source fan over there. Either that, or they’ve realized that if they want Flash to become even more cross-platform, they’ve got to standardize as much as possible or they’ll be drowning in the zillions of tools and compiler oddities, and who knows what other muck.

FlashDevelop

by Josh Tynjala

If you haven’t checked out FlashDevelop, I highly recommend giving it a try. It’s a lightweight Flash editor written in C#, and I recently switched to it for all my AS2 development. Don’t get me wrong, I like Eclipse a lot, and it allowed me a lot of freedom compared to the main Flash IDE, but after playing with FD for a while, Eclipse feels like a 500 ton elephant. FD is quick, and includes most of the features a developer using FAMES is used to.

Read the rest of this entry »

Updated EventManager Includes Mixin Support

by Josh Tynjala

Many people prefer the quick way that EventDispatcher can set up an object to handle events. With one line of code in an object’s constructor you can have an EventDispatcher instance ready to go, plus all the add and remove interface functions will be added to the target object. I’ll admit, it’s pretty elegant.

EventDispatcher.initialize(target);

I’ve updated my EventManager class with the same functionality. Obviously, the implementation is different, but the interface is the same, so all you have to do is call the static function initialize and you’re ready to go. Everything else should work the same way as the previous version. If you use the mixin, an EventManager instance is automatically set in the _eventManager variable of the target object, but initialize also returns the same object if you’d like to assign it elsewhere.

Download a ZIP of the source files for version 1.1!

Flash AIM Demo

by Josh Tynjala

Update: Be sure the check out my second Flash AIM demo with additional features.

Just tossing some code on my blog isn’t the best way to get people excited about it. People want something tangible, something that they can actually play with. As a result, I worked feverishly over the last couple days to get a decent interface for my AIM classes. As I mentioned last time, this is all written in Actionscript 3 for the preview release of Flash Player 8.5. It will not work in Flash 8 or below. If you don’t want to get the player, here’s a screenshot of the new interface in action:

Flash Actionscript 3 AIM Demo Release 1

For those of you ready to take the plunge, you can get it from the downloads section. Due to Flash’s security policies, this swf must be run from your local computer. I’m also warning you that there could be some bugs in there. I tried to find as many as possible, but I don’t doubt that some slipped by me.

Followup: More about Inspectable

by Josh Tynjala

After getting some other work done today, I continued my search for the cause of the major instabilities I’m having with Flash. Last time, I tried to simplify things by creating a blank symbol and setting the class in the Component Definition dialog. Today, I took that a step further. I created the same class, but the class only contains public variables that are Inspectable. Every variable matches an Inspectable getter/setter combo from the original class. You can’t get much simpler than that.

Read the rest of this entry »

Could a lot of Inspectable properties cause Flash to crash?

by Josh Tynjala

Update: I posted some additional information about the Inspectable issue.

So I’m working on some components, and they have Inspectable tags on all the properties that are customizable. Nothing new or exciting here… except that one particular component has a large class heirarchy with well over a hundred properties. Just about every time I mess with one of these properties, Flash starts acting up, and sometimes it even crashes without warning. After trying everything imaginable to track down the problem, I believe that Flash 8 is just having trouble handling so many properties at once.

Originally, I figured Flash was choking on some of the legacy assets in the library. There’s a lot of AS1 code floating around, and since I didn’t work on any of the art assets, there could be all sorts of evil lurking in the dark corners. So, to be extra sure, I created a brand new FLA, and made a new symbol for my component from scratch. I didn’t add any art, it’s just the component on a blank symbol.

After I set the class in the Component Definition dialog, everything is looking good. Then I try to save the FLA. It appears to work, except for one detail: The asterisk that says my file has been modified didn’t disappear. It’s definately not anything in the art. I’ve been hitting this fork in the road for the last two weeks, art or no art. I can continue working and hope that it works the next time I try to save the file (or the FLA gets corrupted and I have to start from scratch or get it back from CVS), or I have to close my FLA and open the last saved version to try doing the same thing over again.

Unfortunately, that’s the better behavior from Flash. Every once in a while, Flash will completely crash on me. Most of the time, Windows throws up that nice little “Ha, ha! Your program sucks! Do you want to tell us about it?” dialog. Usually this happens if a click on the stage somewhere after messing with some properties. Sometimes Flash just closes without any warning whatsoever while I’m compiling my SWF. I’ll just look at the taskbar and notice that it’s gone.

As far as I can tell, no one else is having this problem. I’ve done quite a few Google searches. The only thing I found that sounds anything like this behavior is in the Release Notes for the Flash 7.2 update. In the “Crash Issues Addressed” section, it says 96110 : Component property definition with Inspectable value incorrect will cause crash. As far as I know, all my Inspectable tags are correct. The only thing I’m not sure about is where exactly to use quotes, or if it even matters. Every tutorial for Inspectable is different.

Has anybody else faced problems working with Inspectable, or does anyone from Macromedia know of continued issues with Inspectable causing crashes?

Web Standards Solutions is Polished, Focused, and Fresh

by Josh Tynjala

I don’t like programming books. My own small collection has a lot of snoozers, and only a couple cloudy gems. Lucky for me, the last time I visited the local Barnes and Noble, I discovered Web Standards Solutions: The Markup and Style Handbook by Dan Cederholm. The book is published by Friends of ED, a name I keep hearing, but I hadn’t taken a look at any of their titles yet. After reading this one, I’ll be sure to check out any others I see.

Read the rest of this entry »

An All-in-One Web Development Solution?

by Josh Tynjala

You may have heard about Nicolas Cannasse and his revolutionary MTASC Actionscript 2 compiler. For the developers in the Flash crowd, MTASC brings Actionscript to a completely new level of power and flexibility. Unfortunately, Nicolas announced recently that he doesn’t want to make a version of the compiler for AS3. He points out that MTASC provides a missing tool, but the Flex 2 compiler from Macromedia already provides that and promises to build on it. I’d love some strong open source AS3 tools, but I can understand where he’s coming from. He wants to innovate, not recreate.

Read the rest of this entry »

Connecting to AIM with ActionScript 3 Sockets

by Josh Tynjala

Update: I’ve added some more features to FlashAIM, such as text formatting.

The community has been posting some pretty cool things made with Flex2. Andre Michelle’s blog has been filled with all sorts of interesting 3D and bitmap experiments. Darron Schall presented a preview of his VNC client which takes advantage of bitmap drawing and the new Socket api. Of course, I couldn’t let everyone upstage me, so with a couple weekends of work, I put together some classes for connecting to and interacting with AIM via the TOC 2.0 protocol. I made the basic user interface below just so I’d have a screenshot of the code in action.

Thumbnail image of basic client in action

At the moment, the TocConnection class allows a user to log in, keep track of the status of buddies, send and receive messages, and set his or her own user info. I mainly wanted to get the most vital functions in place before releasing any code. I don’t know if I’ll expand it, but maybe I’ll start a project on OS-Flash so that the community can contribute.

Here’s an example of how to use TocConnection in your own code. In the example, event handlers simple trace the output to the console. We start with initialization of the connection and adding listeners to the events. Generally, when a server message is received from AOL, an event is dispatched so listeners can update their status.

After initialization, and once you receive the connect event, you can start sending and receiving messages, and accessing other data. Here you’ll notice I set my user info right away, and sent a message to SOME_USER. Normally you wouldn’t send automated messages like this, but you can start sending messages to other users after you receive the connection event. Finally, I loop through the list buddies for my account and trace them to the console.

package
{
	import net.zeusdesign.im.aoltoc.*;
	import flash.display.Sprite;
	import flash.util.trace;

	public class ActionTalkTest extends Sprite
	{
		private var _aol:TocConnection; //the main connection class

		public function ActionTalkTest()
		{
			//the constructor takes host and port as params, but there are defaults
			this._aol = new TocConnection();
			this._aol.addEventListener(TocEventType.CONNECT, onAolTocConnect);
			this._aol.addEventListener(TocEventType.DISCONNECT, onAolTocDisconnect);
			this._aol.addEventListener(TocEventType.ERROR, onAolTocError);
			this._aol.addEventListener(TocEventType.RECEIVE_MESSAGE, onAolTocReceiveMessage);
			this._aol.addEventListener(TocEventType.UPDATE_BUDDY, onAolTocUpdateBuddy);
			this._aol.connect("YOUR_SCREEN_NAME", "YOUR_PASSWORD"); //sorry, can't have mine
		}

		private function onAolTocConnect(event:TocEvent):Void
		{
			//set your user info
			this._aol.setUserInfo("This user is connected with ActionTalk.");

			//sendMessage takes a screen name and the message to send to it
			this._aol.sendMessage("SOME_USER", "Hi, I'm talking to you from Flash!");

			//the following adds all your buddies to a string and traces it out
			var output:String = "";
			for(var i:int = 0; i < this._aol.groups.length; i++)
			{
				//a buddy group is basically an array specific to the Buddy class
				var group:BuddyGroup = this._aol.groups[i];
				for(var j:int = 0; j < group.length; j++)
					output += group.buddyAt(j).screenName + " ";
			}
			trace("buddies: " + output);
		}

		//disconnect event handler
		private function onAolTocDisconnect(event:TocEvent):Void
		{
			//raw event data is usually the preparsed string from AOL
			trace("Disconnected. " + event.raw); //raw event data is usually the preparsed string from AOL
		}

Other events include ERROR, RECEIVE_MESSAGE, and UPDATE_BUDDY. As far as I know, errors that you receive after sign-in aren't fatal. If you receive it beforehand, the server will drop the connection. When another user sends you a message, a specialized event tells you the screen name , his or her message, and if the message was automattcally sent (an away message). Another event is triggered whenever the state of one of your buddies changes. Typically, this happens one someone goes offline, becomes idle, or receives a warning.

//error event handler
private function onAolTocError(event:TocErrorEvent):Void
{
	trace("Toc Error: " + event.errorID + " " + event.message + " [" + event.raw + "]");
}

//receive message event handler
private function onAolTocReceiveMessage(event:TocImEvent):Void
{
	var output:String = "";

	//auto variable in TocImEvent marks auto-replies such as away messages
	if(event.auto) output += "Auto-Reply from ";

	//screenName refers to who sent the message and message is what they said
	output += event.screenName + ": " + event.message;
	trace(output);
}

//update buddy event handler
private function onAolTocUpdateBuddy(event:TocUpdateBuddyEvent):Void
{
	//generally updates online status, warning level, and idle time
	trace("Update Buddy: " + event.screenName + " " + event.online + " " + event.warningLevel);
}

That's it. The instant messenger source code is available. Get the free Flex 2 SDK from Adobe.

Impatiently Waiting for ActionScript 3

by Josh Tynjala

I spent the morning today reading up on the future of Flash over at Macromedia Labs. This new repository for pre-release alpha software is bursting with information on Flex 2, ActionScript 3, and the Flash 8.5 plugin. There are so many new features that will make the life of every AS developer so much easier. I almost wish they had waited on this. I’m still exploring Flash 8, and now I’ll be waiting like a little kid for Christmas to actually put AS3 in production.

A lot of people have mentioned interest in regular expressions and E4X, but I’m looking forward to getting rid of all the hacks required to code AS. Firstly, MovieClips are now instantiated like regular variables. We won’t be laughing at newbies when they try this little number anymore:

var mc:MovieClip = new MovieClip();

Not only that, but subclasses can be declared like that too. No more messing with prototypes to get a component on the Stage with only code. Likewise, we don’t need to assimilate root with that method anymore anymore either because now it can be the class of our choice. MovieClips have become so flexible that suddenly there’s a large inheritance chain of specialized display objects. It starts all the way down from a new EventDispatcher class, which acts as a base, and goes up though half a dozen levels that add functionality at each step. Macromedia highlighted a Sprite class which is a perfect lightweight version of MovieClip for components.

Unfortunately, just two days after I presented my new event model, Macromedia announces that they’ve redesigned events from the ground up. If a class has any sort of event in AS2, it uses the newer model in AS3. There goes my hatred for non-standard events. Moreover, Delegate is no longer needed to specify a listener function. It’s built right into addEventListener. Finally, while listener functions still receive a single event object as an argument, there’s a base Event class that we can subclass. I got my strong typing, even if I still have to use the object. They covered every point I made, so I intend to switch back to their version once AS3 officially comes out.

I noticed other interesting tidbits while I skimmed over the docs. There’s a new protected keyword that effectively has the same functionality that private does now. This makes private stronger by hiding members from subclasses too. There’s also a const keyword for making constants. Sealed classes make dynamic properties and methods impossible at runtime. As a language feature, this isn’t necessarily good or bad (I can see arguments both ways), but if a class is sealed, there will be a performance increase, and less memory will be needed in the player. I saw a couple new primitive types–int and uint. They’ll be very useful for when floating points aren’t needed. Lastly, for those of us that will be migrating our code, we’ll no doubt deal with the fact that the mx namespace has been reorganized. Macromedia added many new levels in there, and moved quite a few classes around.

In short, we ActionScript coders are going to be spoiled with so many new tools at our disposal. I’m sure I’ll wish I could build a site in AS3 well before it’s out in final form, but I’m glad we have a lot of time to experiment and learn about the new features. AS3 has matured well beyond it’s years, and its core library definately got a great overhaul. It’s a good time to be a Flash developer.

Pages: Prev 1 2 3 ...11 12 13 14 15 16 17 18 19 20 21 Next