Archive for the ‘Apollo’ Category
Flash Builder 4 beta Released
We had been waiting in eager anticipation through the first half of this year for it to finally arrive. All indications were that we would be well adjusted to our new work flow by the time summer rolled around for sure, enjoying all the new tooling and features of Flex 4, round tripping some super-duper new skins with our design team via Catalyst, and improving our productivity on the whole. But as winter gave way to spring, our excitement began to wane until I had all but forgotten about the coming of this new generation of Flex. When suddenly, with almost no warning whatsoever, it was upon us… the new Flash Builder 4 beta, code named ‘Gumbo’.
Using the Factory Method Pattern
Introduction to a Classic OOP Design Pattern
Throughout my career as a developer I have had the occasion to use the Factory Method Pattern when appropriate, and grown to rely on it extensively in recent months as several projects have dictated. I find this pattern to be extremely useful in creating a loosely-coupled application architecture, which (as we’ve all been indoctrinated) is the cornerstone of well designed apps. It is my hope that this introduction will illuminate this pattern for the uninitiated. Even if you don’t find an immediate application for the Factory Pattern, just understanding the ‘why’ and ‘how’ of this design can be important in grasping the importance of the “open-closed” principle, and will help you to write better code.
Let me start off by giving the standard text-book definition of the pattern:
The Factory Pattern “…define[s] an interface for creating an object, but allows the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses.”
AS3 Tutorial – The Singleton Pattern
One of the most important patterns that we use over here is the Singleton. It’s used when you need to restrict use of a class to one or only one instance. This comes in handy when you are casting things like application wide settings, or if you are building something like a logging service. There is a bit of disagreement on the use of the singleton, but it really boils down to two questions:
- Will you use this class exactly the same way?
- Will you only ever need only one instance of this class?
If you answer yes to these two questions, you might have the case to build a singleton. – So here is how you go about doing it in AS3 -it’s a bit tricksy ’cause as3 has no private constructors:
AS3 Remoting ArrayCollection Tutorial – Part I
Okay, we’ve all used the <mx:RemoteObject> tag before, but now that we are following some good design principles and using a model view controller setup, we want to get rid of that tag and put the remote object logic into it’s own class.
When you decide to go ahead and start creating your own remote object classes in AS3, your’re going to have to keep in mind not only good design principles, but also encapsulation. This post is going to show you how to create an AS3 class that encapsulates the logic for connecting to a server side data service (In this one I am going to use ColdFusion, but you can easily substitute your own Ruby or Php based service). We are going to assume that you have a good understanding of Object Oriented AS3, as well as the AS3 event model.
ActionScript Tutorial – Encapsulation, Get and Set
Ready to take the plunge into the wild world of oo ? Then here’s a quick tutorial that will get you started on one of the most important concepts behind oo -encapsulation. In this post I will explain what the concept of encapsulation is, how to use it to make your code easier to manage, more resistant to errors, and best of all, more reusable.
ActionScript Custom Event Tutorial Part II
This post refers to AS3 Custom Event Tutorial
K, so you’re now extending the event object, having all sorts of fun, bouncing events all up and down your object tree like the destructive monkey that you are. But the question remains: How are you going to capture the events that you are dispatching? The simple answer: the event listener…which may be the most common construct in AS3. The event lister take the following form, where the eventHandler is the function we want to handle the event:
someObject.addEventListener(eventType,eventHandler);
private function eventHandler(event:eventClass):void{
//do something fun here;
}
Custom Flex Components and outerDocument
Note to self, use the outerDocument.yourMethod keyword to target methods outside the custom component. For example if I make a custom component called myCal, using it as an item renderer, and I’m trying to propagate a custom event, I have to target the event listener method by using the outerDocument scope.
<mx:itemRenderer>
<mx:Component>
<MyComp:calGridComp dateChosen="outerDocument.dateEventHandler(event);"/>
</mx:Component>
</mx:itemRenderer>
Restore, Resize, and Move a window with Apollo
We’re having a bunch of fun with the Apollo alpha over here at Curious Minds. Here is some simple code that will replicate OS window behavior. The maximizeWindow function either sets the app window to full screen or restores the size of the window depending on the state of the isWindowMax variable. These functions are all tied to the “click” function of the appropriate buttons. Read more »
AS2 / Flash 8 and Apollo
Create a chromeless, transparent Apollo / Flash Widget for the desktop, complete with minimize and close buttons.
This should be a good starting point for those of you who would like to get on the flash widget train.
NOTE: If you are more comfortorable with Flash Remoting versus Flex Remoting, you will be pleased to know that I did do a quick test, and queries via CF from Flash worked fine in my wee Apollo app.
Download source
Removing Default Apollo Chrome
Just change this:
<mx:ApolloApplication>
To this:
<mx:Application>
Thats pretty much it. I don’t think that this is in the Apollo documentation that came with the alpha. Had to carefully examine the WeatherStation sample app.
Leave a Comment
Leave a Comment
Leave a Comment