home *** CD-ROM | disk | FTP | other *** search
- package game.model
- {
- import org.puremvc.as3.interfaces.IProxy;
- import org.puremvc.as3.patterns.proxy.Proxy;
-
- public class NotesProxy extends Proxy implements IProxy
- {
-
- public static const NAME:String = "NotesProxy";
-
-
- private var notes:Array;
-
- public function NotesProxy()
- {
- super(NAME);
- init();
- }
-
- private function init() : void
- {
- notes = [];
- }
-
- private function sendNote() : void
- {
- var note:Object = notes[0];
- if(note.name != GameProxy.UPDATE)
- {
- trace("note!",note.name);
- }
- sendNotification(note.name,note.body);
- sendNoteComplete();
- }
-
- public function push(name:String, body:Object = null) : void
- {
- var note:Object = {
- "name":name,
- "body":body
- };
- notes.push(note);
- if(notes.length == 1)
- {
- sendNote();
- }
- }
-
- private function sendNoteComplete() : void
- {
- notes.splice(0,1);
- if(notes.length > 0)
- {
- sendNote();
- }
- }
- }
- }
-