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
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
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.
*/
public function notifyObservers(infoObj:Object):void {
// Use a null infoObject if none is supplied.
if (infoObj == undefined) {
infoObj = null;
}
// Make a copy of the observers array. We do this so that we
// can be sure the list won't change while we're processing it.
var observersSnapshot:Array = observers.slice(0);
// Invoke update() on all observers.
for (var i in observersSnapshot) {
observersSnapshot[i].update(this, infoObj);
}
}
/**
* Removes all observers from the observer list.
*/
public function clearObservers():void {
observers = new Array();
}
/**
* Returns the number of observers in the observer list.
* @return An integer: the number of observers for this subject.
*/
public function countObservers():Number {
return observers.length;
}
}
}
And Observer:
package observer
{
public interface Observer
{
//function update(o:Observable, infoObj:Object):void;
function updateStats(score:Number,damage:String):void;
}
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders