MAY THE SOURCE BE WITH YOU…

I have just released GOF.

Game Object Framework is a framework for making games. GOF describes different types of entities and how they should interact. The open source code is in ActionScript 3.0 and is mainly composed of interfaces; however, the concepts are not specific to any platform.

to learn more: http://imanit.com/blog/?p=85

to browse UML: http://www.scuge.com/gof/uml/

to download code: http://code.google.com/p/gameobjectframework/source/checkout

to discuss: email iman@imanit.com

What is Game Object Framework?

December 8th, 2009

Game Object Framework is a framework for making games. GOF describes different types of entities and how they should interact. The open source code is in ActionScript 3.0 and is mainly composed of interfaces; however, the concepts are not specific to any platform.

Game Object Framework was designed with the following in mind: minimize complexity and maximize re-usability.

Benefits of GOF:

If you use GOF instead of not using a framework, your code will be easier to read and maintain. Moreover, it will be easier to generate estimates and the code you produce will prove to be more reusable. As regards to the impact of GOF on teams, your team will work together more effectively as GOF provides a common language for team members to talk about the game with. Additionally, GOF provides out of the box code separations that are useful in assigning tasks to developers.

More specifically, GOF code is easier to read because of the clear metaphors and classifications. It’s easier to maintain because GOF guidelines force specific logic in to specific places in the code. Because GOF breaks a game up into standard smaller parts, you can estimate development time by estimating in terms of these parts. GOF is as reusable as possible because logic has been encapsulated based on commonality and variability. For example you can develop an engine you can reuse in all your games, a state manager you can use for all of your physics games and maybe even 3 renderers one for all of your 2D games, another for all of your 2.5 D games and a third for all of your 3D games. Once these pieces are written they are reusable since they use a standard interface.

GOF Layers:

GOF is composed of the game stream layer, and the game engine layer. The game stream layer is a nice and friendly layer where you think about the game objects you’re going to add. Programming in this layer most resembles the games design. Logic in this layer only applies to that specific game. This layer behaves a lot like spring does, you simply instantiate the game objects with their properties and let the lower layers handle the rest. The game engine layer is all the code that has to exist to support the game stream layer. Here is where the math is done, where the game loop delegates tasks like collecting moves, calculating the next state, and rendering.

GOF Entities:

Game Stream: All of the different parts of GOF in one way or another support the game stream. The game stream is the part of the game that contains all of the action. The game stream is made up completely of living, breathing game objects. GOF does not concern itself with the part of the game experience which navigates to, or navigates out of, or complements the game stream; it simply creates game streams. To do this, the greater game code must:

1.Instantiate a game stream
2.Register the core parts of the game stream.
3.Add the game objects to the game stream.

The game stream is controlled through various exposed public functions like “start” and “togglePausePlay”, and the stream also dispatches events that the greater game code user can listen to.

Game Objects: Game Objects, or GOs, are the thing a user notices when playing a game. If something is drawn, or has a state, or makes a move, it is a game object. The classes that represent the game objects should store all of the data necessary for the game object to be processed by the game engine. In other words, if the game object must be rendered, it should include display data. And if the game engine must make a move, it should include a reference to the class that returns the move.

Our top layer simply consists of creating a game stream. This top layer is made possible by the next layer down, the game engine layer.

Game Engine: The game engine layer begins with the game engine. The game stream works directly with and is supported by the game engine.

We have divided all of the functionality needed to run a stream into parts. The game engine supports the game stream by conducting these various parts.

What all game stream’s have in common is that they have a state, have to be able to generate the next state(based on its current state and inputs) and must be able to render this state to the screen.

This definition tells us that the functional parts of our game must be to manage state, get inputs, and draw. Since these classes can be implemented a number of ways, we create a common interface for each class, and the engine will use that interface without worrying about implementation details.

The game engine layer executes a game loop on interfaces for the main framework parts. The main framework parts for a game include:

oTranslator: Translates state positions into display object positions.
oRenderer: Logic that draws the scene.
oState Manager: Logic in charge of going from one state to the next based on user input.
oTurn Manager: Logic in charge of managing who’s turn it is.

Additionally, the game stream should also aggregate a “controller,” which helps bubble events from the state manager up through the game stream.

You can download GOF here: http://code.google.com/p/gameobjectframework/source/checkout

you can browse the UML here: http://www.scuge.com/gof/uml/

Ellie Khabazian is an amazing attorney who really understands software contracts.  She has been negotiating and reviewing my contracts for years now
and as a result my exposure has been minimized.

She will be giving an 80 minute presentation at Flex 360 this year and her talk alone is worth the price of admission.

You can register for the conference here:
http://360flex-elliek.eventbrite.com/

If you are interested in having your contracts reviewed or negotiated she has a great promotion runing right now here:
http://www.lawthought.com/developers

You can learn more about Ellie here:
http://www.lawthought.com/

With all the great programming frameworks out there, its important to be able to understand which,if any, will do your project the most good.

The goal of such an analysis is not to find a winner, but to identify project conditions that cause the framework’s benefit to vary, and determine how beneficial or detrimental each framework is under each condition. In this article I outline the conditions and criteria that should be considered when choosing the right framework for your project (regardless of coding platform).  This article is written for developers, architects, and development team leaders.

Conditions to be aware of:

Understand that the same framework that is ideal for one type of project may not be ideal for another type. Here is a list of conditions and anti-conditions that would likely make one framework ideal over another:

multi-developer vs. single developer

internal software vs. web experience

5 screen application vs. 40 screen application

get the project out right vs get the project out right now

There are many other conditions that vary which framework is ideal for your project. It’s important to know what conditions you are under and how each framework adds value under those generic conditions.

Benefits:

Below, I introduce seven criteria to consider when determining the benefits of a framework: Project Re-scope Proposition, Performance and Memory Management, Re-usability, Extendability, and Code Complexity, Testability, and Eco-system.

Project Re-scope Proposition:

Every framework has what I call, a project re-scope proposition. Before any architecture is done, or framework is chosen, we identify the project scope by answering “How should I (or my team) program this application?”. The question(s) that needs to be answered to define identify the development scope is/are the scope proposition.

Choosing a framework will replace the original scope proposition with a new set of questions, our re-scoped proposition . For example, In PureMVC, the questions that allow us to identify project scope are “What are the Commands, Proxies, and Mediators that need to be written? What do the commands need to do? What data should the proxies abstract? What components will the mediators manage? and How will this all be done?” We can add more detailed questions like “How will the application start-up?, What functionality will the facade expose?” And, if we want to get really advanced, we can break the project up into MVC cores. That is just an example of one framework’s project re-scope proposition; every framework re-scopes the project.

Choosing a framework, and software architecting, create a proposes by which the set of questions in a scope proposition are constantly replaced with more questions, questions that are more specific, as constraints are laid out around the solution. In order to accept the constraints of a prospective framework or architecture, you (the developer) should be more comfortable meeting the demands of the scope proposition implied by that decision, than the scope proposition previous to that decision at every step,

Performance and Memory Management:

You should understand the performance and memory management implications of the frameworks you are choosing from. Does the framework have to be used a certain way in order to provide good performance and memory management? Does the framework have any internal memory leaks? Is the framework optimized?

Performance can be less important for RIAs  (than games, or video), barring issues that are noticeable by users (slow UI, unresponsiveness).  Memory Management may also be less important for internal software than experiences intended for the web.

Re-usability:

A framework is reusable to the extent that it offers out of the box functionality that you would have had to write if you hadn’t chosen that framework (PureMVCs startup logic comes to mind). A framework is re-usability friendly to the extent the framework encourages you to write reusable code.  For example, if a framework decouples the view from any other part of the program, and puts no constraints on view components, then you can write reusable view components.

Re-usability (like complexity) is measurable. An application’s re-usability is the amount of time that will be saved for all future projects by leveraging code written for that application.

Extendability

A framework is extendable to the extent the framework follows the open-closed principle (http://en.wikipedia.org/wiki/Open/closed_principle ) for classes that represent entities which vary in behavior between projects.

Code Complexity:

A good framework encourages low class complexity.

Simple classes are simple to write, test, debug, and modify. Complex classes are not. A simple class will require the developer to have less information about the rest of the program than a complex class will. Based on the definition of a simple versus a more complex class, we can define a project’s code complexity.

We define the complexity for a class as the amount of functions and properties it can access.

We define the measurement of the code complexity for an entire program as the sum of the the complexities of the classes.(Please note, these are my own definitions.)

The complexity of a code base is predicated by the amount of classes that are imported and the amount of members each class exposes to the importing class.

This concept re-enforces the importance of defining access for your members (public/private/protected/ [internal or friend])

Testability

A good framework encourages classes written on top to be easily testable. Here is a great article that describes how to write code that is more easily testable: http://googletesting.blogspot.com/2008/08/by-miko-hevery-so-you-decided-to.html

Eco-System

The Eco-System describes the real world factors outside of the framework code that can add value to the experience of working with a particular framework. Does the framework have a forum or email list? Is/are the author(s) accessible? Is there a large user base that will help you with your questions? Are there other libraries or tools (i.e. PureMVC Console) developed for that particular framework that add value?

Conclusion

I hope this article has established guidelines for an analysis of code frameworks.  The decision is not simple, as this article has already touched on two dimensions (conditions versus criteria) with at least 4 and 7 elements in each dimension, respectively.

In my next article I will attempt to deal with concrete frameworks and provide some analysis using the guidelines submitted here.

Flash Team Tools Presentation

September 17th, 2009

Hello,

I really enjoyed presenting at LA Flash.  By popular request my slides are below (click through with space bar):

Flash Team Tools Slide Show

Thanks,

Speaking at L.A. Flash: Team Tools

September 10th, 2009

I will be speaking at LA Flash on September 16, 2009.  I will discuss how various tools improve the swf development process.

http://laflash.eventbrite.com/

Fellow Developers,

If you are a contractor your going to want to look into the link below.  The Law Office of Ellie Khabazian is offering a special package for developer contract review.  She is my attorney (and sister) and always does an amazing job for me:

http://www.lawthought.com/component/content/article/3-newsflash/70-special-promotion-on-contract-reviewnegotiations-for-developers

Hello Everyone,

I have worked with The Buddy Group (TBG) in the past, and this is an awesome company to work at.  The CEO is a terrific guy, so if you are looking for work in Irvine, California, then I have some great news to share.

TBG is looking to fill two very exciting roles.

SR. Flash Developer Buddy

and
Director of Technology/Development Buddy- need to have profound experience in all aspects of digital production and distribution.
To learn more about TBG, check out:

http://buddyblog.com
http://youtube.com/dotlotdigitalstudios
http://facebook.com/thebuddygroup

Flash Team Tools

May 31st, 2009

Hello Everybody,

I attended Flash camp the other day.  The adobe guys/gals were all really nice.  It seems to me that with Flash Catalyst and all the new flex features raw actionscript developers (like myself) are being compelled to jump on the flex bandwagon.  I asked the flex engineers why they can’t break out flex functionality into libraries that raw actionscript developers could import as needed.  I don’t know that I got a satisfactory answer.  In any case the new Flex components are the first adobe components that I would actually feel good about using.  Very skinable, very well architected.  If you where there I was the tall persian guy with my wife wearing matching Apollo tee shirts.  Now I am just getting ready to fly home to orange county and getting ready to present at O. C. Flash

I will be presenting flash team tools at OC flash on Tuesday June 2.  I will cover a bunch of tools that I use and Love.  My notes below:

Design:
Enterprise Architect: specifications, classes, database tables, sequences, export.
CASE Tool, supports full SDLC modeling with UML 2.1
http://www.sparxsystems.com.au/

GnanttProject: Gnant Charts
GanttProject is a cross-platform desktop tool for project scheduling and management. It runs on Windows, Linux and MacOSX, it is free and its code is opensource.  Create work breakdown structure, draw dependencies, define milestones.
Assign human resources to work on tasks, see their allocation on the Resource Load chart.
Save charts as PNG images, generate PDF and HTML reports. Import projects from and export them to Microsoft Project formats. Export to spreadsheets with CSV.
http://www.ganttproject.biz/

Development:
Mantis: Task and Bug Tracking
Open source, php based, highly configurable
http://www.mantisbt.org/

Sharepoint:  Task and Bug management
 IIS, highly configurable
 http://sharepoint.microsoft.com/Pages/Default.aspx

Tortoise: Commit, update, branch, Merge, Diff(code review)
A Subversion client, implemented as a windows shell extension.
http://tortoisesvn.tigris.org/
Winmerge: Merge, diff (code review):
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
http://winmerge.org/

XMLNotepad: Create XML.
XML Notepad 2007 provides a simple intuitive user interface for browsing and editing XML documents.

Paint.NET: Images
Paint.NET is free image and photo editing software for computers that run Windows.
http://www.getpaint.net/

FileZilla:
Free FTP.
http://filezilla-project.org/
Debug
Alcon
Alcon is a lightweight debugging tool for ActionScript developers that provides several straightforward and quickly accessible methods to debug any ActionScript 2 or ActionScript 3 application, be it from the Web Browser, the standalone Flash Player or an AIR Runtime
http://blog.hexagonstar.com/alcon/

De Monster Debugger
De MonsterDebugger is an open source debugger for Adobe Flash, Flex and AIR. De MonsterDebugger is made in Flex and AIR by design studio De Monsters.
http://demonsterdebugger.com/

PureMVC Consule
This project is intended to help Flex and AS3 application developers, that use the PureMVC framework for AS3 – simple or multicore version – by providing them deep insights on what happens at the framework level: Notifications, Commands, Mediators and Proxies.
http://lab.kapit.fr/display/puremvcconsole/PureMVC+Console

Wireshark
Wireshark is the world’s foremost network protocol analyzer, and is the de facto (and often de jure) standard across many industries and educational institutions.
http://www.wireshark.org/
 
Webload
The WebLOAD Open Source Load Generation Engine is an open source project sponsored by RadView Software.
http://www.webload.org/

Pure MVC Awesome practices

April 30th, 2009

As I have worked extensively with PureMVC I have taken note of practices that make life easier. I wouldn’t call them “Best Practices” because who am I to say whats best. But these practices have saved me tons of time and I value my time, thus the titles.

#1: As we know each Mediator is responsible for exactly one view component. If you are loading the artwork from flash the visual elements of the view component should be stored in a single dedicated FLA (no monolith FLAs, one FLA/swf per viewcomponent). Its common work flow when you have a team of developers each gets assigned to a view component. This way you don’t get locking issues on the FLA or SWF.

 

#2: View components should aggregate Sprite (or MovieClip), not extend it. Extending Sprite has become an all to often practice for dealing with view components. Gang of Four tells us to prefer aggregation. If your Display Object hierarchy is defined in the Flash IDE, using the sprite instead of extending the sprite means you don’t have to link the sprite to your code inside of flash, and thus don’t have to compile code in the Flash IDE (which really helps out work flow and development time). View components should probably extend a “viewComponent” base class that comes with shared view component functionality (ie verifies the Display Object Hierarchy).

 

#3: Design a unit test for each view component. All to often when thinking about unit tests we think the class is the unit to test. Doing this usually creates constraints that take away from object oriented design. Remember, as front end developers our view components are our primary units, and they are event driven, so class testing becomes academic. Think of the view component as the unit to test. One view component should map to one swf so now all you need is a unit test that embeds or loads that swf, and runs the component through its paces. Every view component should pass its unit test before being integrated into the application.

 

#4: Use a “navigation” command and “navigation” notification: The navigation command should be tied to a navigation notification which is broadcast whenever the user wants to navigate to a new macro state of the application. The new macro state should have a name, which is carried in the payload of the notification. Allow for transition states with loading steps if you plan on tweening between states. The transition state and step should be stored in the state proxy as well.

 

Although its the mediators job to transition whenever a navigation notification is handled, it will be the navigation commands job to deep link using swfaddress, and update the stateproxy with the new application state. On the other hand the swfaddress.change event should send a navigation notification as well, via logic that parses the new address. Watchout though, responding to address change isn’t that simple as you need to make sure your application is sufficiently initialized before sending the navigation notification.

 

#5: Understand the difference between macro-states and view component states. Macro-states need to be accessible through-out the application. For example, any state information stored in the URL is a part of the macro-state. However only the given view component needs to know the view component state, so don’t store any view component state information in the model.

 

#6: Mediators should inherit from one of a few base Mediators. Your application represents certain visual metaphors to the user . For example the visual metaphors might consist of Pages, Popups, Modules and Menus. When this is the case, all of your mediators for pages should inherit from an Abstract Page Mediator, as with Popups , Modules and Menus. Before architecting your application, understand the view metaphors, and use those base metaphors as abstract mediators.

 

#7: Know what MVC will help you with, and what it wont help you with. MVC is all about a systematic way to startup, handle user gestures, and back-end events. This should be the starting point for designing out our architecture. The pure MVC tutorial’s fully cover startup best practices. As for user gestures, the view component should wisely keep some things to itself, while translating other gestures into dispatched events. The mediator will then respond to those events, sometimes by sending a notification, sometimes by accessing a proxy to change the model. It is important to separate what the gestures the view component needs to know about, versus what the mediator needs to know about, versus what the MVC layer needs to know about. The gestures should also change there name as they are passed from view component to mediator to MVC layer, because there significance changes in each separate context.

 

As for backed service calls, use the same proxy that handles the request to handle the response. Use a responder pattern and delegates to handle parsing.

 

If you need to handle some occurrence that is neither startup, a gesture, or back end event, consider handling it within a view component and not on the MVC layer . For example, MVC isn’t here to manage a game stream, so if you are writing a game use the MVC layer to navigate to the game, to manage widgets and the heads up display, but the game stream should be managed within a view component.

 

#8: Whenever the Model changes and view components need to be updated as a result , the proxy should send a DATA_REFRESH notification so Mediators may update data supplied to view components.

 

#9: All Vos should inherit from a base VO, all VOCollections should inherit from a base VOCollection. See the end of this article for example base VO and base VOCollection code.

 

#10: Don t worry about using the facade. One misunderstanding most developers have after reading the PureMVC tutorials is that they will be doing a bunch of work with the facade. Maybe this is true if you are creating a logic layer, and the facade exposes some complex api. Usually the facade only exposes startup and holds constants, and the applications entry point is the only entity that calls a function from the facade. Turns out the real work is under the hood of the facade for most RIAs.

 

#11: Here is a list of some proxies I always use and information about each:

ConfigProxy: Reads in the config.xml file. Uses a config VO custom to the data in the config.xml file. See ConfigProxy and LoadEXDelegate code below.

StartupMonitorProxy: Fully documented in PureMVC docs. Really makes loading easy.

TextProxy: Works a lot like the configProxy but reads a text.xml file and uses a textVO to contain all text that will be used in application.

 

 

#12: Use the PureMVC consule, this thing is wicked!!!

 

#13: A. Always, B. be, M. Multi coring, always be multi coring. Why use single core, its not easier, and it could paint you in a corner.

 

#14: Preload with a preloadorMediator that listens for the Loading Step notifications dispatched by the startupMonitor Proxy.

 

#15: Be happy you picked PureMVC. If it seems more complex than your needs are just wait until your client comes back with suggestions and you will be glad you picked a framework that can handle complexity.

 

Hey lets be friends,

add me to linked in: http://www.linkedin.com/pub/dir/?last=khabazian&first=iman

or come see me in person as I will be speaking at various Flash/Flex user groups throughout southern California in May or June (schedule will be posted soon but I have confirmed San Diego Users Group May 20th at 6pm and OC Flash at 7pm June second, and L.A. Flex in July).

 

///////////////////////////////////////////////////////////

// VO.as

// ActionScript 3.0 Implementation of the Class VO

// Created on: 03-May-2008 12:24:46 AM

// Original author: iMAN Khabazian

///////////////////////////////////////////////////////////

 

package com.iMANIT.ImplementationPatterns

{

 

 

/**

*

*

* public class VO

* {

* public var objectProxy:Proxy = new Proxy();

* public var voEvent:VOEvent;

*

* // id:String get/set

* public function get id():String { return objectProxy.getData(id)};

* public function set id( p_id:String ):void { objectProxy.setData(id , p_id)};

* }

* @author iMAN Khabazian

* @version 1.0

* @created 03-May-2008 12:24:46 AM

*/

public class VO

{

public var id: uint;

 

/**

* constructor.

*/

public function VO(tID: uint):void

{

if (tID)

{

id = tID;

}

 

}

public function toString():String

{

return (“VO: ” + id);

}

 

}//end VO

 

}

///////////////////////////////////////////////////////////

// VOCollection.as

// ActionScript 3.0 Implementation of the Class VOCollection

// Created on: 03-May-2008 12:24:46 AM

// Original author: iMAN Khabazian

///////////////////////////////////////////////////////////

 

package com.iMANIT.ImplementationPatterns

{

 

 

/**

* Contains all VOs of a particular type.

* @author iMAN Khabazian

* @version 1.0

* @created 03-May-2008 12:24:46 AM

*/

 

 

public class VOCollection

{

 

/**

* Array of VOs

* We need to support: add, removebyID

*/

// public var VOs: Array;

protected var localAr:Array;

protected var name:String = “Generic Collection”;

/**

* constructor, inits Array

*/

public function VOCollection(ar:Array=null, name:String = null)

{

if (name) this.name = name;

if (ar) localAr = ar;

else localAr = new Array();

}

 

/**

* @inheritDoc

*/

public function get length():int

{

return localAr.length;

}

 

public function getItemAt(index:int):Object

{

 

if (index < 0 || index >= length)

{

trace(” VOCollection.getItemAt OutOfBounds”);

return(new Object());

}

// trace (“VOCollection.getItemAt: ” + index + “)” + localAr[index]);

 

return localAr[index];

 

}

/*

*

*/

public function add(item:Object): int

{

// trace (“VOCollection.add: ” + item.toString());

localAr.push(item);

return localAr.length – 1;

}

/**

*

*/

public function setItemAt(item:Object, index:int):void

{

if (index < 0 || index >= length)

{

trace(” VOCollection.setItemAt OutOfBounds”);

}

else

{

localAr[index] = item;

}

}

 

public function getIndexFor(item:Object):int

{

 

for (var cntx:int =0; cntx < localAr.length; cntx++ )

{

if (localAr[cntx] == Object) return cntx;

}

return(-1);

}

public function getItemByName(name: String):Object

{

 

for (var cntx:int =0; cntx < localAr.length; cntx++ )

{

if (localAr[cntx].name == name)

{

return (localAr[cntx]);

}

}

return(undefined);

}

public function toString():String

{

var outputString: String = ” ” + this.name +”(“+localAr.length +”)” ;

 

if (localAr.length > 0)

for (var cntx:int =0; cntx < localAr.length; cntx++ )

{

outputString +=”\n “+ cntx+”)” + localAr[cntx].toString();

}

else

{

outputString = “:EMPTY”;

}

 

 

return outputString;

}

 

public function copy():VOCollection

{

var retCollection: VOCollection = new VOCollection();

for (var cntx:int =0; cntx < localAr.length; cntx++ )

{

retCollection.add(localAr[cntx].copy);

}

 

return retCollection;

}

 

public function sortOn(fieldName: Object): void

{

localAr.sortOn(fieldName,[Array.NUMERIC]);

}

 

}//end VOCollection

package AppMVC.Model.Business

{

import flash.errors.*;

import flash.events.Event;

import mx.rpc.IResponder;

import flash.net.URLLoader;

import flash.net.URLRequest;

import Utils.Debugger;

public class LoadEXDelegate

{

private var responder : IResponder;

private var url:String;

private var loader:URLLoader;

private var mainXML:XML;

public function LoadEXDelegate( responder : IResponder, url:String)

{

loader = new URLLoader();

this.url = url;

this.responder = responder;

}

 

public function load() : void

{

loader.addEventListener(Event.COMPLETE, onComplete);

loader.load(new URLRequest(url));

}

private function onComplete(evt:Event): void

{

try

{

mainXML = new XML(loader.data)

 

} catch(e:Error)

{

this.responder.fault(e);

return;

}

this.responder.result(mainXML);

}

}

}

 

 

package AppMVC.Model

{

///////////////////////////////////////////////////////////

// ConfigProxy.as

// Macromedia ActionScript Implementation of the Class ConfigProxy

// Generated by Enterprise Architect

// Created on: 03-Jul-2008 5:32:12 PM

// Original author: iMAN

///////////////////////////////////////////////////////////

import VOs.ConfigVO;

import org.puremvc.as3.patterns.proxy.Proxy;

import APPMVC.Model.Helpers.ConfigEXResource;

import D4MVC.Model.Business.LoadEXDelegate;

import D4MVC.ApplicationFacade;

import mx.rpc.IResponder;

import Utils.Debugger; 

/**

* anything loaded from external Config file

* @author iMAN

* @version 1.0

* @created 03-Jul-2008 5:32:12 PM

*/

public class ConfigProxy extends Proxy implements IResponder

{

public static const NAME:String = “ConfigProxy”;

 

/**

* Constructor

*

* @param proxyName

* @param data

*/

public function ConfigProxy(data:Object = null )

{

super(NAME, data);

startupMonitorProxy = facade.retrieveProxy( StartupMonitorProxy.NAME ) as StartupMonitorProxy;

startupMonitorProxy.addResource( ConfigProxy.NAME, true );

 

 

}

public function load():void

{

// reset the data

this.data = new Object();

// create a worker who will go get some data

// pass it a reference to this proxy so the delegate knows where to return the data

var delegate : LoadEXDelegate = new LoadEXDelegate(this, ‘data/config.xml’);

delegate.load();

}

// this is called when the delegate receives a result from the service

public function result(rpcObject:Object ) : void

{

data= ConfigEXResource.parse(rpcObject);

this.startupMonitorProxy.resourceComplete( ConfigProxy.NAME );

}

// this is called when the delegate receives a fault from the service

public function fault(info:Object) : void

{

Debugger.log (“ConfigProxy.fault”);

// log.debug(“SuggestionProxy.fault”);

// send the failed notification

this.sendNotification( ApplicationFacade.LOAD_FAILED, “ConfigProxy Failed, ” + info.toString() );

}

Proudly powered by WordPress. Theme developed with WordPress Theme Generator.
Copyright © MAY THE SOURCE BE WITH YOU…. All rights reserved.