Re: [Flashcoders] MVC - ScreenManager

2012-03-27 Thread Peter Ginneberge

I have Command classes for that in combination with a ServiceLocator (Singleton) that 
holds all the services.
Commands are instantiated (only when needed) and executed by the Controller.
Commands, when executed, fetch the required service (RemoteService/WebService/HTTPService) from the ServiceLocater, listens for 
events on the service and executes it.

When data returns it is stored in the Model, which then dispatches a change 
event.

regards,
Peter

- Original Message - 
From: Creighton, Gerry gcreigh...@discmakers.com

To: Flash Coders List flashcoders@chattyfig.figleaf.com
Sent: Monday, March 26, 2012 7:07 PM
Subject: Re: [Flashcoders] MVC - ScreenManager



If I'm loading XML would that be done in the model or the controller?




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-26 Thread Creighton, Gerry
If I'm loading XML would that be done in the model or the controller?


On 3/9/12 9:06 AM, Glen Pike g...@engineeredarts.co.uk wrote:

:D

On 09/03/2012 05:20, Karl DeSaulniers wrote:
 If you can't take the Henrik, get out of the kitchen.. lol


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-26 Thread Ross Sclafani
In my approach, the controller loads the XML, then puts it in the model which 
causes a CHANGE event to dispatch.

Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 26, 2012, at 1:07 PM, Creighton, Gerry gcreigh...@discmakers.com 
wrote:

 If I'm loading XML would that be done in the model or the controller?
 
 
 On 3/9/12 9:06 AM, Glen Pike g...@engineeredarts.co.uk wrote:
 
 :D
 
 On 09/03/2012 05:20, Karl DeSaulniers wrote:
 If you can't take the Henrik, get out of the kitchen.. lol
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-26 Thread tom rhodes
well, either you can add an Service to MVC and get MVCS, or perhaps your
main app controller would load it if it's config stuff and set up models
accordingly. i imagine you have a model ready and waiting to store the info
in?

basically you want to keep app logic out of models, they just want to be
about data. so either do it in a controller that updates your model, or
have a controller use a service (so you don't bloat the controller) which
updates a model.

On 26 March 2012 19:07, Creighton, Gerry gcreigh...@discmakers.com wrote:

 If I'm loading XML would that be done in the model or the controller?


 On 3/9/12 9:06 AM, Glen Pike g...@engineeredarts.co.uk wrote:

 :D
 
 On 09/03/2012 05:20, Karl DeSaulniers wrote:
  If you can't take the Henrik, get out of the kitchen.. lol
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-26 Thread Creighton, Gerry
I thought that it should be in the controller. Just wanted to be certain.

Thanks,

-Gerry

On 3/26/12 1:21 PM, tom rhodes tom.rho...@gmail.com wrote:

well, either you can add an Service to MVC and get MVCS, or perhaps your
main app controller would load it if it's config stuff and set up models
accordingly. i imagine you have a model ready and waiting to store the
info
in?

basically you want to keep app logic out of models, they just want to be
about data. so either do it in a controller that updates your model, or
have a controller use a service (so you don't bloat the controller) which
updates a model.

On 26 March 2012 19:07, Creighton, Gerry gcreigh...@discmakers.com
wrote:

 If I'm loading XML would that be done in the model or the controller?


 On 3/9/12 9:06 AM, Glen Pike g...@engineeredarts.co.uk wrote:

 :D
 
 On 09/03/2012 05:20, Karl DeSaulniers wrote:
  If you can't take the Henrik, get out of the kitchen.. lol
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] MVC - ScreenManager

2012-03-26 Thread Merrill, Jason
I wouldn't put it in the controller, it a data thing.  I create a class that 
loads in XML as a service class, and have the model load the service, 
dispatching an event when done that the controller picks up on.  MVCS. 

 Jason Merrill
 Instructional Technology Architect II
 Bank of America  Global Learning 





___

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Creighton, Gerry
Sent: Monday, March 26, 2012 1:25 PM
To: Flash Coders List
Subject: Re: [Flashcoders] MVC - ScreenManager

I thought that it should be in the controller. Just wanted to be certain.

Thanks,

-Gerry

On 3/26/12 1:21 PM, tom rhodes tom.rho...@gmail.com wrote:

well, either you can add an Service to MVC and get MVCS, or perhaps 
your main app controller would load it if it's config stuff and set up 
models accordingly. i imagine you have a model ready and waiting to 
store the info in?

basically you want to keep app logic out of models, they just want to 
be about data. so either do it in a controller that updates your model, 
or have a controller use a service (so you don't bloat the controller) 
which updates a model.

On 26 March 2012 19:07, Creighton, Gerry gcreigh...@discmakers.com
wrote:

 If I'm loading XML would that be done in the model or the controller?


 On 3/9/12 9:06 AM, Glen Pike g...@engineeredarts.co.uk wrote:

 :D
 
 On 09/03/2012 05:20, Karl DeSaulniers wrote:
  If you can't take the Henrik, get out of the kitchen.. lol
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

--
This message w/attachments (message) is intended solely for the use of the 
intended recipient(s) and may contain information that is privileged, 
confidential or proprietary. If you are not an intended recipient, please 
notify the sender, and then please delete and destroy all copies and 
attachments, and be advised that any review or dissemination of, or the taking 
of any action in reliance on, the information contained in or attached to this 
message is prohibited. 
Unless specifically indicated, this message is not an offer to sell or a 
solicitation of any investment products or other financial product or service, 
an official confirmation of any transaction, or an official statement of 
Sender. Subject to applicable law, Sender may intercept, monitor, review and 
retain e-communications (EC) traveling through its networks/systems and may 
produce any such EC to regulators, law enforcement, in litigation and as 
required by law. 
The laws of the country of each sender/recipient may impact the handling of EC, 
and EC may be archived, supervised and produced in countries other than the 
country in which you are located. This message cannot be guaranteed to be 
secure or free of errors or viruses. 

References to Sender are references to any subsidiary of Bank of America 
Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are 
Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a 
Condition to Any Banking Service or Activity * Are Not Insured by Any Federal 
Government Agency. Attachments that are part of this EC may have additional 
important disclosures and disclaimers, which you should read. This message is 
subject to terms available at the following link: 
http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you 
consent to the foregoing.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-26 Thread Ross Sclafani
All services in my MVC strategy are extensions to the controller tree that 
controllers use to get data from outside to put in the model. In my world, 
models don't do they hold so outside of their inner framework mechanisms, 
they are only made up of getters, setters, and vars.
All public methods in my MVC apps belong in the controller, or occasionally  
displayobject subclasses that are used by views, but not view subclasses 
themselves.

Division of duties:

Models - public vars/accessors

Controllers - public methods for manipulating model's public properties.

Views - private vars/methods to implement display logic based on model updates.

Again I can only speak about how wildly effective my approach is, but I'm sure 
there are merits to others where mine succeeds in simplicity.

Strokes / folks...

Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 26, 2012, at 1:37 PM, Merrill, Jason jason.merr...@bankofamerica.com 
wrote:

 I wouldn't put it in the controller, it a data thing.  I create a class that 
 loads in XML as a service class, and have the model load the service, 
 dispatching an event when done that the controller picks up on.  MVCS. 
 
 Jason Merrill
 Instructional Technology Architect II
 Bank of America  Global Learning 
 
 
 
 
 
 ___
 
 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com 
 [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Creighton, 
 Gerry
 Sent: Monday, March 26, 2012 1:25 PM
 To: Flash Coders List
 Subject: Re: [Flashcoders] MVC - ScreenManager
 
 I thought that it should be in the controller. Just wanted to be certain.
 
 Thanks,
 
 -Gerry
 
 On 3/26/12 1:21 PM, tom rhodes tom.rho...@gmail.com wrote:
 
 well, either you can add an Service to MVC and get MVCS, or perhaps 
 your main app controller would load it if it's config stuff and set up 
 models accordingly. i imagine you have a model ready and waiting to 
 store the info in?
 
 basically you want to keep app logic out of models, they just want to 
 be about data. so either do it in a controller that updates your model, 
 or have a controller use a service (so you don't bloat the controller) 
 which updates a model.
 
 On 26 March 2012 19:07, Creighton, Gerry gcreigh...@discmakers.com
 wrote:
 
 If I'm loading XML would that be done in the model or the controller?
 
 
 On 3/9/12 9:06 AM, Glen Pike g...@engineeredarts.co.uk wrote:
 
 :D
 
 On 09/03/2012 05:20, Karl DeSaulniers wrote:
 If you can't take the Henrik, get out of the kitchen.. lol
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 --
 This message w/attachments (message) is intended solely for the use of the 
 intended recipient(s) and may contain information that is privileged, 
 confidential or proprietary. If you are not an intended recipient, please 
 notify the sender, and then please delete and destroy all copies and 
 attachments, and be advised that any review or dissemination of, or the 
 taking of any action in reliance on, the information contained in or attached 
 to this message is prohibited. 
 Unless specifically indicated, this message is not an offer to sell or a 
 solicitation of any investment products or other financial product or 
 service, an official confirmation of any transaction, or an official 
 statement of Sender. Subject to applicable law, Sender may intercept, 
 monitor, review and retain e-communications (EC) traveling through its 
 networks/systems and may produce any such EC to regulators, law enforcement, 
 in litigation and as required by law. 
 The laws of the country of each sender/recipient may impact the handling of 
 EC, and EC may be archived, supervised and produced in countries other than 
 the country in which you are located. This message cannot be guaranteed to be 
 secure or free of errors or viruses. 
 
 References to Sender are references to any subsidiary of Bank of America 
 Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are 
 Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a 
 Condition to Any Banking Service or Activity * Are Not Insured by Any Federal 
 Government Agency

Re: [Flashcoders] MVC - ScreenManager

2012-03-09 Thread Glen Pike

:D

On 09/03/2012 05:20, Karl DeSaulniers wrote:

If you can't take the Henrik, get out of the kitchen.. lol



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] MVC - ScreenManager

2012-03-08 Thread Terry Riney

Good morning,

Like others before me I would like to really learn MVC by first doing my 
own as opposed to a framework. This link is very close to what I need to 
accomplish:


http://www.ultrashock.com/index.php/forum/viewthread/80283/

I have put my work in but keep getting block in one way or another, can 
anyone point me in the direction of this setup in AS3 so I can at least 
get that part of the plan out of the way (this link is AS2 and it seems 
any reference to AS3 on this site is a dead end).


Any help would be appreciated.

Terry Riney
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Ross Sclafani
This guys approach sounds a lot like mine. At an airport but I'll try to check 
out his files 

Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 8, 2012, at 9:14 AM, Terry Riney tri...@blueridgetechsolutions.com 
wrote:

 Good morning,
 
 Like others before me I would like to really learn MVC by first doing my own 
 as opposed to a framework. This link is very close to what I need to 
 accomplish:
 
 http://www.ultrashock.com/index.php/forum/viewthread/80283/
 
 I have put my work in but keep getting block in one way or another, can 
 anyone point me in the direction of this setup in AS3 so I can at least get 
 that part of the plan out of the way (this link is AS2 and it seems any 
 reference to AS3 on this site is a dead end).
 
 Any help would be appreciated.
 
 Terry Riney
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Terry Riney

On 3/8/2012 9:49 AM, Ross Sclafani wrote:

This guys approach sounds a lot like mine. At an airport but I'll try to check 
out his files

Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 8, 2012, at 9:14 AM, Terry Rineytri...@blueridgetechsolutions.com  
wrote:


Good morning,

Like others before me I would like to really learn MVC by first doing my own as 
opposed to a framework. This link is very close to what I need to accomplish:

http://www.ultrashock.com/index.php/forum/viewthread/80283/

I have put my work in but keep getting block in one way or another, can anyone 
point me in the direction of this setup in AS3 so I can at least get that part 
of the plan out of the way (this link is AS2 and it seems any reference to AS3 
on this site is a dead end).

Any help would be appreciated.

Terry Riney
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Thanks, Ross.  The author uses a Factory Method and I want to create 
different sets of games each with it's own sound/grid so I was going to 
substitute an Abstract Factory like this:


http://www.as3dp.com/2009/01/actionscript-30-abstract-factory-design-pattern-multiple-products-and-factories/

That is the first change. I will begin transition his code to as3 this 
afternoon though it takes me a little longer than most so someone may 
post it before I finish but at least one can see I am attempting to give 
it a go.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Terry Riney

On 3/8/2012 11:16 AM, Terry Riney wrote:

On 3/8/2012 9:49 AM, Ross Sclafani wrote:
This guys approach sounds a lot like mine. At an airport but I'll try 
to check out his files


Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 8, 2012, at 9:14 AM, Terry 
Rineytri...@blueridgetechsolutions.com  wrote:



Good morning,

Like others before me I would like to really learn MVC by first 
doing my own as opposed to a framework. This link is very close to 
what I need to accomplish:


http://www.ultrashock.com/index.php/forum/viewthread/80283/

I have put my work in but keep getting block in one way or another, 
can anyone point me in the direction of this setup in AS3 so I can 
at least get that part of the plan out of the way (this link is AS2 
and it seems any reference to AS3 on this site is a dead end).


Any help would be appreciated.

Terry Riney
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Thanks, Ross.  The author uses a Factory Method and I want to create 
different sets of games each with it's own sound/grid so I was going 
to substitute an Abstract Factory like this:


http://www.as3dp.com/2009/01/actionscript-30-abstract-factory-design-pattern-multiple-products-and-factories/ 



That is the first change. I will begin transition his code to as3 this 
afternoon though it takes me a little longer than most so someone may 
post it before I finish but at least one can see I am attempting to 
give it a go.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



I suppose everyone has their own project structure, thought I would just 
use default package. Hopefully this thread will generate the interest 
the other mvc threads have and others will begin to agree on one:


package
{
public class GameUpdate
{
public var state:String;
public var images:Array;
public var img_index:Number;
public var title:String;
public var percent:Number;

public function GameUpdate(state:String, images:Array, 
img_index:Number, title:String, percent:Number) {

this.state = state;
this.images = images;
this.img_index = img_index;
this.title = title;
this.percent = percent;
}
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Terry Riney

On 3/8/2012 11:38 AM, Terry Riney wrote:

On 3/8/2012 11:16 AM, Terry Riney wrote:

On 3/8/2012 9:49 AM, Ross Sclafani wrote:
This guys approach sounds a lot like mine. At an airport but I'll 
try to check out his files


Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 8, 2012, at 9:14 AM, Terry 
Rineytri...@blueridgetechsolutions.com  wrote:



Good morning,

Like others before me I would like to really learn MVC by first 
doing my own as opposed to a framework. This link is very close to 
what I need to accomplish:


http://www.ultrashock.com/index.php/forum/viewthread/80283/

I have put my work in but keep getting block in one way or another, 
can anyone point me in the direction of this setup in AS3 so I can 
at least get that part of the plan out of the way (this link is AS2 
and it seems any reference to AS3 on this site is a dead end).


Any help would be appreciated.

Terry Riney
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Thanks, Ross.  The author uses a Factory Method and I want to create 
different sets of games each with it's own sound/grid so I was going 
to substitute an Abstract Factory like this:


http://www.as3dp.com/2009/01/actionscript-30-abstract-factory-design-pattern-multiple-products-and-factories/ 



That is the first change. I will begin transition his code to as3 
this afternoon though it takes me a little longer than most so 
someone may post it before I finish but at least one can see I am 
attempting to give it a go.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



I suppose everyone has their own project structure, thought I would 
just use default package. Hopefully this thread will generate the 
interest the other mvc threads have and others will begin to agree on 
one:


package
{
public class GameUpdate
{
public var state:String;
public var images:Array;
public var img_index:Number;
public var title:String;
public var percent:Number;

public function GameUpdate(state:String, images:Array, 
img_index:Number, title:String, percent:Number) {

this.state = state;
this.images = images;
this.img_index = img_index;
this.title = title;
this.percent = percent;
}
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Would like to pass a score/time/damage to client will stick with 
score/damage right now:


package observer{
import observer.Observer;

/**
 * A Java-style Observable class used to represent the subject
 * of the Observer design pattern. Observers must implement the 
Observer

 * interface, and register to observe the subject via addObserver().
 */
public class Observable {
// A list of observers.
private var observers:Array;

/**
 * Constructor function.
 */
public function Observable() {
observers = new Array();
}

/**
 * Adds an observer to the list of observers.
 * @param   o   The observer to be added.
 */
public function addObserver(o:Observer):Boolean {
// Can't add a null observer.
if (o == null) {
return false;
}

// Don't add an observer more than once.
for (var i:Number = 0; i  observers.length; i++) {
if (observers[i] == o) {
// The observer is already observing, so quit.
return false;
}
}

// Put the observer into the list.
observers.push(o);
return true;
}

/**
 * Removes an observer from the list of observers.
 * @param   o   The observer to remove.
 */
public function removeObserver(o:Observer):Boolean {
// Find and remove the observer.
var len:Number = observers.length;
for (var i:Number = 0; i  len; i++) {
if (observers[i] == o) {
observers.splice(i, 1);
return true;
}
}
return false;
}

/**
 * Tell all observers that the subject has changed.
 * @param   infoObj   An object containing arbitrary data  to 
pass to observers.

 */

Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Terry Riney

On 3/8/2012 11:47 AM, Terry Riney wrote:

On 3/8/2012 11:38 AM, Terry Riney wrote:

On 3/8/2012 11:16 AM, Terry Riney wrote:

On 3/8/2012 9:49 AM, Ross Sclafani wrote:
This guys approach sounds a lot like mine. At an airport but I'll 
try to check out his files


Ross P. Sclafani
Owner / Creative Director
Neuromantic Industries
http://www.neuromantic.com
http://ross.sclafani.net
http://www.twitter.com/rosssclafani
347.204.5714

On Mar 8, 2012, at 9:14 AM, Terry 
Rineytri...@blueridgetechsolutions.com  wrote:



Good morning,

Like others before me I would like to really learn MVC by first 
doing my own as opposed to a framework. This link is very close to 
what I need to accomplish:


http://www.ultrashock.com/index.php/forum/viewthread/80283/

I have put my work in but keep getting block in one way or 
another, can anyone point me in the direction of this setup in AS3 
so I can at least get that part of the plan out of the way (this 
link is AS2 and it seems any reference to AS3 on this site is a 
dead end).


Any help would be appreciated.

Terry Riney
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Thanks, Ross.  The author uses a Factory Method and I want to create 
different sets of games each with it's own sound/grid so I was going 
to substitute an Abstract Factory like this:


http://www.as3dp.com/2009/01/actionscript-30-abstract-factory-design-pattern-multiple-products-and-factories/ 



That is the first change. I will begin transition his code to as3 
this afternoon though it takes me a little longer than most so 
someone may post it before I finish but at least one can see I am 
attempting to give it a go.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



I suppose everyone has their own project structure, thought I would 
just use default package. Hopefully this thread will generate the 
interest the other mvc threads have and others will begin to agree on 
one:


package
{
public class GameUpdate
{
public var state:String;
public var images:Array;
public var img_index:Number;
public var title:String;
public var percent:Number;

public function GameUpdate(state:String, images:Array, 
img_index:Number, title:String, percent:Number) {

this.state = state;
this.images = images;
this.img_index = img_index;
this.title = title;
this.percent = percent;
}
}
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



Would like to pass a score/time/damage to client will stick with 
score/damage right now:


package observer{
import observer.Observer;

/**
 * A Java-style Observable class used to represent the subject
 * of the Observer design pattern. Observers must implement the 
Observer

 * interface, and register to observe the subject via addObserver().
 */
public class Observable {
// A list of observers.
private var observers:Array;

/**
 * Constructor function.
 */
public function Observable() {
observers = new Array();
}

/**
 * Adds an observer to the list of observers.
 * @param   o   The observer to be added.
 */
public function addObserver(o:Observer):Boolean {
// Can't add a null observer.
if (o == null) {
return false;
}

// Don't add an observer more than once.
for (var i:Number = 0; i  observers.length; i++) {
if (observers[i] == o) {
// The observer is already observing, so quit.
return false;
}
}

// Put the observer into the list.
observers.push(o);
return true;
}

/**
 * Removes an observer from the list of observers.
 * @param   o   The observer to remove.
 */
public function removeObserver(o:Observer):Boolean {
// Find and remove the observer.
var len:Number = observers.length;
for (var i:Number = 0; i  len; i++) {
if (observers[i] == o) {
observers.splice(i, 1);
return true;
}
}
return false;
}

/**
 * Tell all observers that the subject has changed.
 * @param   infoObj   An object containing arbitrary data  to 

Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Henrik Andersson
Terry Riney skriver:
 Would like to pass a score/time/damage to client will stick with
 score/damage right now:
 
 package observer{
 import observer.Observer;
 
 /**
  * A Java-style Observable class used to represent the subject
  * of the Observer design pattern. Observers must implement the
 Observer
  * interface, and register to observe the subject via addObserver().
  */

Congratulations on reinventing the EventDispatcher class. I hope you had
fun reinventing the wheel.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Terry Riney

On 3/8/2012 12:42 PM, Henrik Andersson wrote:

Terry Riney skriver:

Would like to pass a score/time/damage to client will stick with
score/damage right now:

package observer{
 import observer.Observer;

 /**
  * A Java-style Observable class used to represent the subject
  * of the Observer design pattern. Observers must implement the
Observer
  * interface, and register to observe the subject via addObserver().
  */

Congratulations on reinventing the EventDispatcher class. I hope you had
fun reinventing the wheel.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



I will be writing code in other languages. As my first post said this is 
for my use. If I start changing things and someone follows this post it 
will be difficult to follow along. You comments are noted if a little on 
the strident side.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] MVC - ScreenManager

2012-03-08 Thread Karl DeSaulniers

If you can't take the Henrik, get out of the kitchen.. lol


On Mar 8, 2012, at 11:53 AM, Terry Riney wrote:


On 3/8/2012 12:42 PM, Henrik Andersson wrote:

Terry Riney skriver:

Would like to pass a score/time/damage to client will stick with
score/damage right now:

package observer{
import observer.Observer;

/**
 * A Java-style Observable class used to represent the subject
 * of the Observer design pattern. Observers must implement the
Observer
 * interface, and register to observe the subject via  
addObserver().

 */
Congratulations on reinventing the EventDispatcher class. I hope  
you had

fun reinventing the wheel.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



I will be writing code in other languages. As my first post said  
this is for my use. If I start changing things and someone follows  
this post it will be difficult to follow along. You comments are  
noted if a little on the strident side.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders