/ Published in: ActionScript 3
The singleton model extends EventDispatcher and fires events when it is updated by the controller.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; } } }
URL: neonsunburst.com