Neonsunburst Model Class


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. package com.neonsunburst {
  2.  
  3. import flash.events.*;
  4.  
  5. public class Model extends EventDispatcher {
  6.  
  7. public static var totalPages:int;
  8. public static var currentPage:int;
  9. public static var previousPage:int;
  10.  
  11. function Model() {
  12. totalPages = 3;
  13. currentPage = 1;
  14. }
  15. function setCurrentPage(p:int) : void {
  16. previousPage = currentPage;
  17. currentPage = p;
  18. trace (this + " currentPage is " + currentPage);
  19. trace (this + " previousPage is " + previousPage);
  20. dispatchEvent(new Event(Event.CHANGE));
  21. }
  22. function getCurrentPage() : int {
  23. return currentPage;
  24. }
  25. function getPreviousPage() : int {
  26. return previousPage;
  27. }
  28. function getTotalPages() : int {
  29. return totalPages;
  30. }
  31.  
  32.  
  33. }
  34. }

URL: neonsunburst.com

Report this snippet


Comments


You need to login to view comments.