diff nodejs/mbapp.js @ 978:78312b44f48c

Implement Scene API.
author wycc
date Sat, 20 Nov 2010 20:04:31 +0800
parents e4474cac20da
children 593a418ed8bf
line wrap: on
line diff
--- a/nodejs/mbapp.js	Sat Nov 20 15:46:03 2010 +0800
+++ b/nodejs/mbapp.js	Sat Nov 20 20:04:31 2010 +0800
@@ -145,6 +145,34 @@
     }
 }
 
+
+app.prototype.changeScene=function(s) {
+    var nth;
+    if (typeof(s)=='number') {
+        var i;
+	nth = s;
+    } else {
+        nth = this.svg.getFrameNumber(s);
+	if (nth == -1) return;
+    }
+    var scenes = this.svg.scenes;
+    for(i=0;i<scenes.length;i++) {
+        try {
+            if (nth >=scenes[i].start && nth <=scenes[i].end) {
+	        this.get(scenes[i].ref).show();
+	    } else {
+	        this.get(scenes[i].ref).hide();
+	    }
+	} catch(e) {
+	    sys.puts(e);
+	    sys.puts(scenes[i].ref);
+	}
+    }
+}
+app.prototype.addSceneListener=function(n, cb) {
+    sys.puts("This is not implemented yet")
+}
+
 var app_with_win = function(display, win) {
     var self = this;
     var mb_rt;