Return to Snippet

Revision: 30671
at August 19, 2010 04:03 by derrekwayne


Updated Code
package com.neonsunburst {
	
    import flash.events.*;
    
	public class Model extends EventDispatcher {

		public static var totalPages:int;
		public static var currentPage:int;
		public static var previousPage:int;

		function Model() {
			totalPages = 3;
			currentPage = 1;
		}
		function setCurrentPage(p:int) : void {
				previousPage = currentPage;
				currentPage = p; 
				trace (this + " currentPage is " + currentPage); 
				trace (this + " previousPage is " + previousPage); 
				dispatchEvent(new Event(Event.CHANGE));
		}
		function getCurrentPage() : int {
			return currentPage;
		}
		function getPreviousPage() : int {
			return previousPage;
		}
		function getTotalPages() : int {
			return totalPages;
		}
		
		
	}
}

Revision: 30670
at August 19, 2010 04:00 by derrekwayne


Initial Code
package com.neonsunburst {
	
    import flash.events.*;
    
	public class Model extends EventDispatcher {

		public static var totalPages:int;
		public static var currentPage:int;
		public static var previousPage:int;

		function Model() {
			trace ("model");
			totalPages = 3;
			currentPage = 1;
		}
		function setCurrentPage(p:int) : void {
				previousPage = currentPage;
				currentPage = p; 
				trace (this + " currentPage is " + currentPage); 
				trace (this + " previousPage is " + previousPage); 
				dispatchEvent(new Event(Event.CHANGE));
		}
		function getCurrentPage() : int {
			return currentPage;
		}
		function getPreviousPage() : int {
			return previousPage;
		}
		function getTotalPages() : int {
			return totalPages;
		}
		
		
	}
}

Initial URL
neonsunburst.com

Initial Description
The singleton model extends EventDispatcher and fires events when it is updated by the controller.

Initial Title
Neonsunburst Model Class

Initial Tags
actionscript

Initial Language
ActionScript 3