/ Published in: ActionScript 3
The Controller class handles user gestures through navigation logic and updates the Model.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package com.neonsunburst { import flash.events.*; public class Controller { var model:Model; public function Controller (aModel:Model) { model= aModel; model.addEventListener(Event.CHANGE, update); if (model.hasEventListener(Event.CHANGE)) { trace ("Event.CHANGE regestered in controller"); }; } public function forward() : void { // VIEW GESTURE IN if (model.getCurrentPage() == model.getTotalPages()) { model.setCurrentPage(1); } else { model.setCurrentPage(model.getCurrentPage() + 1 ); } } public function backward() : void { // VIEW GESTURE IN if (model.getCurrentPage() == 1) { model.setCurrentPage( model.getTotalPages() ); } else { model.setCurrentPage( model.getCurrentPage() - 1 ); } } } }
URL: neonsunburst.com