チェンジセット 1616
- コミット日時:
- 2008/10/14 17:23:20 (3 年前)
- ファイル:
-
- ruby/jsplash/trunk/client2/index.xml (更新) (1 diff)
- ruby/jsplash/trunk/client2/jsplash/executor.js (更新) (3 diffs)
- ruby/jsplash/trunk/client2/jsplash/objects.js (更新) (12 diffs)
- ruby/jsplash/trunk/client2/jsplash/player.js (更新) (3 diffs)
- ruby/jsplash/trunk/client2/jsplash/swfglobal.js (更新) (2 diffs)
- ruby/jsplash/trunk/client2/jsplash/tags.js (更新) (8 diffs)
- ruby/jsplash/trunk/jextract.rb (更新) (11 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
ruby/jsplash/trunk/client2/index.xml
r1579 r1616 54 54 <div id="progbar"><div> </div></div> 55 55 <p id="statusout"> </p> 56 <p id="sout"><em>JSplash Player</em> 0.4.1 0<br />-------------------------------------<br /></p>56 <p id="sout"><em>JSplash Player</em> 0.4.11<br />-------------------------------------<br /></p> 57 57 <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 58 58 </svg> ruby/jsplash/trunk/client2/jsplash/executor.js
r1525 r1616 74 74 }, 75 75 76 processAdditionalSprites: function() { 77 for(;this.additionals.length>0;) { 78 this.advanceFrame( this.additionals.shift(), 0 ); 79 } 80 }, 81 76 82 tick: function() { 77 83 this.executed_stat = 0; … … 86 92 } 87 93 88 for(;this.additionals.length>0;) { 89 // console.log("ADD "+this.additionals[this.additionals.length-1]); 90 this.advanceFrame( this.additionals.pop(), 0 ); 91 } 92 //console.log("--------------------------------------------------------------------"); 94 this.processAdditionalSprites(); 93 95 this.doReservedActions(); 96 94 97 95 98 this.additionals = []; … … 102 105 } 103 106 104 for(;this.additionals.length>0;) { 105 // console.log("ADD "+this.additionals[this.additionals.length-1]); 106 this.advanceFrame( this.additionals.pop(), 0 ); 107 } 108 107 this.processAdditionalSprites(); 109 108 this.doReservedActions(); 110 109 //console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); ruby/jsplash/trunk/client2/jsplash/objects.js
r1579 r1616 46 46 this.shape_disposed = false; 47 47 this.overridden = false; 48 this.dynamic = false; 48 49 49 50 this.mousePos = {x:0, y:0}; … … 54 55 this.nameMap = {}; 55 56 this.frameActionFuncs = {}; 57 this.handlerActionFuncs = {}; 56 58 this.topDepths = [0]; 57 59 58 60 this.instance_uid = JSplash.ObjectInstance.next_id++; 61 this.listeningMouse = false; 59 62 60 63 if (g) … … 200 203 this.removeObject(depth); 201 204 } 205 206 if (!po.sleeping){ 207 return po; 208 } 202 209 203 210 if (po) { … … 234 241 if (klass.renderer) 235 242 inst.renderer = klass.renderer; 236 243 // inst.g.setAttribute("id", "kid-"+klass.classId); 237 244 inst.render(); 238 245 /* when replace previous frame */ … … 573 580 }, 574 581 582 doHandlerAction: function(handler_name) { 583 if (!this.klass) 584 return; 585 var vlist = this.klass.getVarList(); 586 if (!this.handlerActionFuncs[handler_name]) { 587 var a = this.klass.getHandlerOf(handler_name); 588 if (a && a.action) 589 this.handlerActionFuncs[handler_name] = new JSplash.ActionInstance(a.action); 590 } 591 592 if (this.handlerActionFuncs[handler_name]) { 593 var varlist = this.klass.getVarList(); 594 this.execScript(this.handlerActionFuncs[handler_name], varlist); 595 } 596 }, 597 575 598 execScript: function(act, local_vlist, local_vlist2) { 576 599 var P = this.getProxy(); … … 693 716 var m = [t.sx, t.kx, t.ky, t.sy, t.mx, t.my]; 694 717 695 this.g.setAttribute("transform", "matrix("+m.join(' ')+") rotate("+ t.r+")" );718 this.g.setAttribute("transform", "matrix("+m.join(' ')+") rotate("+(t.r||0)+")" ); 696 719 }, 697 720 … … 728 751 P._xmouse = this.mousePos.x; 729 752 P._ymouse = this.mousePos.y; 753 754 if (this.is_stage) { 755 P.width = this.width; 756 P.height = this.height; 757 } 730 758 731 759 this.putViewSize(P); … … 745 773 }, 746 774 775 addStyleClass: function(nm) { 776 if (this.g) { 777 var cls = this.g.getAttribute("class"); 778 if (cls) 779 if (cls.indexOf(nm) >= 0) return; 780 781 this.g.setAttribute("class", cls ? (cls+" "+nm) : nm); 782 } 783 }, 784 785 initButton: function() { 786 this.rewind(); 787 788 var list = this.klass.buttonDatas; 789 if (!list) return; 790 var len = list.length; 791 for (var i = 0;i < len;i++) { 792 var b = list[i]; 793 // console.log(b.st); 794 if (b.st == 8) 795 continue; // don't place hitArea sprite 796 797 var po = this.placeObject(1+i, b.id, undefined, undefined, 0, false, false); 798 if (po) { 799 if ((b.st&1) != 0) po.addStyleClass("jsplash-btn-up"); 800 if ((b.st&2) != 0) po.addStyleClass("jsplash-btn-over"); 801 if ((b.st&4) != 0) po.addStyleClass("jsplash-btn-down"); 802 } 803 } 804 805 if (!this.listeningMouse) 806 { 807 Event.observe(this.g, "mouseup", this.onMouseUp.bind(this)); 808 this.listeningMouse = true; 809 } 810 811 this.showFrame(); 812 }, 813 814 onMouseUp: function() { 815 this.doHandlerAction("on_release"); 816 }, 817 747 818 // Movie Controls 748 819 stop: function() { … … 774 845 this.gotoFrame(fi); 775 846 this.play(); 847 }, 848 849 attachMovie: function(id, inst_name, depth) { 850 var inst = this.placeObject(depth, JSplash.gPlayer.stage.lookupExportedSymbol(id), inst_name, undefined, false, false, false); 851 inst.dynamic = true; 852 this.executor.processAdditionalSprites(); 853 this.getProxy().__setChidrenRefs__(); 854 return inst.getProxy(); 776 855 } 777 856 } 778 857 779 JSplash.ObjectInstance.createStageObject = function(taglist, g, label_map ) {858 JSplash.ObjectInstance.createStageObject = function(taglist, g, label_map, exports) { 780 859 var s = new JSplash.ObjectInstance(taglist, null, g); 860 s.exports = exports; 781 861 s.label_map = label_map; 782 862 s.mouse_down = false; 783 863 s.is_stage = true; 784 864 s.bitmapRefs = {}; 865 s.width = s.height = 100; 785 866 786 867 Object.extend(s, { … … 836 917 getImageRef: function(oid) { 837 918 return this.bitmapRefs[oid] || null; 919 }, 920 921 lookupExportedSymbol: function(name) { 922 if (!this.exports) return null; 923 return this.exports[name]; 838 924 } 839 925 } ); // extend … … 859 945 for (var depth in dmap) { 860 946 ch = dmap[depth]; 861 if (!ch.sleeping )947 if (!ch.sleeping && !ch.dynamic) 862 948 { 863 949 this.depthMap[depth] = ch; … … 882 968 this.gotoAndStop = obj.gotoAndStop.bind(obj); 883 969 this.gotoAndPlay = obj.gotoAndPlay.bind(obj); 970 this.attachMovie = obj.attachMovie.bind(obj); 884 971 885 972 this._totalframes = 1; ruby/jsplash/trunk/client2/jsplash/player.js
r1579 r1616 22 22 svg.style.width = swf.pxWidth + "px"; 23 23 svg.style.height = swf.pxHeight + "px"; 24 this.stage = new JSplash.ObjectInstance.createStageObject(swf.taglist, svg, swf.label_map); 24 this.stage = new JSplash.ObjectInstance.createStageObject(swf.taglist, svg, swf.label_map, swf.exports); 25 this.stage.width = swf.pxWidth; 26 this.stage.height = swf.pxHeight; 25 27 26 28 if (swf.bitmaps) … … 126 128 127 129 JSplash.initPlayer = function() { 130 document.styleSheets[0].insertRule(":hover>.jsplash-btn-up{visibility:hidden;}", 0); 131 132 document.styleSheets[0].insertRule(".jsplash-btn-over{visibility:hidden;}", 0); 133 document.styleSheets[0].insertRule(":hover>.jsplash-btn-over{visibility:visible; cursor:pointer;}", 0); 134 document.styleSheets[0].insertRule(":active>.jsplash-btn-over{opacity: 0;}", 0); 135 136 document.styleSheets[0].insertRule(".jsplash-btn-down{visibility:hidden;}", 0); 137 document.styleSheets[0].insertRule(":active>.jsplash-btn-down{visibility:visible;}", 0); 138 128 139 var swf = new JSplash.SWF(JSplash.swfdata); 129 140 var player = new JSplash.Player(swf, $('svgrt')); … … 212 223 this.label_map = sdat.label_map; 213 224 this.bitmaps = sdat.bitmaps; 225 this.exports = sdat.exports; 214 226 } 215 227 ruby/jsplash/trunk/client2/jsplash/swfglobal.js
r1457 r1616 15 15 g.SharedObject = JSplash.SWFGlobals.SharedObject; 16 16 g.Sound = JSplash.SWFGlobals.Sound; 17 g.__inherit__ = JSplash.SWFGlobals.inheritClass; 17 18 } 18 19 … … 29 30 } 30 31 32 JSplash.SWFGlobals.inheritClass = function(base, subcls) { 33 Object.extend(subcls.prototype, base.prototype); 34 35 subcls.prototype._super = base.prototype; 36 subcls.prototype.__super__ = base; 37 subcls.prototype.super_ctor = function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){ 38 var so = new this.__super__(a,b,c,d,e,f,g,h,i,j,k,l,m,n); 39 Object.extend(so, this); 40 }; 41 } 31 42 32 43 JSplash.SWFGlobals.SharedObject = { ruby/jsplash/trunk/client2/jsplash/tags.js
r1565 r1616 13 13 var has_trans = (data.mov || data.scl || data.skw); 14 14 var has_clrtrans = (data.cfct || data.cofs); 15 15 16 16 var inst = owner.placeObject(data.d, data.id, data.name, data.cl, data.r, (data.r && !has_trans), (data.r && !has_clrtrans && !data.ctr)); 17 17 if (!inst) { … … 38 38 ky = data.skw[1]; 39 39 } 40 40 41 try { 41 42 inst.setTransform(tx, ty, sx, sy, kx, ky); … … 73 74 inst.setAlpha(1); 74 75 } 76 77 if (inst.klass.isButton) { 78 inst.initButton(); 79 } 75 80 }, 76 81 … … 92 97 owner.stop(); 93 98 owner.rewind(true); 94 // console.log("END");95 99 }, 96 100 … … 118 122 this.frameActions = null; 119 123 this.tagData = data; 124 this.classId = data ? data.id : null; 120 125 if (data) { 121 126 if (data.tag == JSplash.tDefineShape) { … … 134 139 this.label_map = data.label_map || null; 135 140 } 141 else if (data.tag == JSplash.tDefineButton2) { 142 this.isButton = true; 143 this.buttonDatas = data.buttons; 144 } 136 145 } 137 146 } … … 158 167 }, 159 168 169 getHandlerOf: function(name) { 170 if (!this.frameActions) 171 this.loadActions(); 172 173 if (!this.frameActions) 174 return null; 175 176 var a = this.frameActions[name]; 177 return a; 178 }, 179 160 180 frameActionAt: function(fi) { 161 181 if (!this.frameActions) … … 165 185 return null; 166 186 167 var a = this.frameActions['frame_'+fi] 187 var a = this.frameActions['frame_'+fi]; 168 188 return a; 169 189 }, ruby/jsplash/trunk/jextract.rb
r1579 r1616 8 8 $shared_jpeg_table = nil 9 9 $bitmap_refs = nil 10 $exports = nil 11 12 def make_trans(trans) 13 mov = nil 14 scl = nil 15 skw = nil 16 if trans 17 a = trans 18 19 mov = ",mov:[#{a['transX']},#{a['transY']}]" if a['transX'] 20 scl = ",scl:[#{a['scaleX'].to_f},#{a['scaleY'].to_f}]" if a['scaleX'] 21 skw = ",skw:[#{a['skewX'].to_f},#{a['skewY'].to_f}]" if a['skewX'] 22 end 23 24 "#{mov}#{scl}#{skw}" 25 end 10 26 11 27 def make_rgb(attrs) … … 24 40 25 41 "L:#{vL},R:#{vR},T:#{vT},B:#{vB}" 42 end 43 44 def read_a_button(btn) 45 attrs = btn.attributes 46 f_up = attrs['up'].to_i 47 f_over = attrs['over'].to_i << 1 48 f_down = attrs['down'].to_i << 2 49 f_hit = attrs['hitTest'].to_i << 3 50 51 state = f_up | f_over | f_down | f_hit 52 return nil if state == 0 53 54 trans_e = btn.elements['./transform/Transform'] 55 trans = trans_e ? make_trans(trans_e.attributes) : nil 56 57 "{st:#{state},id:#{attrs['objectID'].to_i}#{trans}}" 58 end 59 60 def read_buttons(buttons) 61 parsed_buttons = [] 62 63 buttons.elements.each{|b| 64 next if b.name != "Button" 65 66 br = read_a_button(b) 67 parsed_buttons << br if br 68 } 69 70 parsed_buttons.join(',') 26 71 end 27 72 … … 73 118 a = trans 74 119 75 mov = ",mov:[#{a['transX'] },#{a['transY']}]" if a['transX']76 scl = ",scl:[#{a['scaleX'] },#{a['scaleY']}]" if a['scaleX']77 skw = ",skw:[#{a['skewX'] },#{a['skewY']}]" if a['skewX']120 mov = ",mov:[#{a['transX'].to_f},#{a['transY'].to_f}]" if a['transX'] 121 scl = ",scl:[#{a['scaleX'].to_f},#{a['scaleY'].to_f}]" if a['scaleX'] 122 skw = ",skw:[#{a['skewX'].to_f},#{a['skewY'].to_f}]" if a['skewX'] 78 123 end 79 124 … … 172 217 173 218 class TagReaders 219 def self.readExport(tg, nest, fi) 220 a = tg.elements['./symbols/Symbol'].attributes 221 222 oi = a['objectID'].to_i 223 nm = a['name'] 224 225 $exports = Hash.new if !$exports 226 $exports[nm] = oi 227 end 228 174 229 def self.readSetBackgroundColor(tg, nest, fi) 175 230 clr = tg.elements['./color/Color'].attributes … … 220 275 end 221 276 222 def self.readPlaceObject2(tg, nest, fi) 277 def self.readPlaceObject3(tg, nest, fi) 278 return TagReaders.readPlaceObject2(tg, nest, fi, 3); 279 end 280 281 def self.readPlaceObject2(tg, nest, fi, v = nil) 223 282 trans = nil 224 283 trans = tg.elements['./transform/Transform'].attributes if tg.elements['./transform'] … … 243 302 244 303 mov = ",mov:[#{a['transX']},#{a['transY']}]" if a['transX'] 245 scl = ",scl:[#{a['scaleX'] },#{a['scaleY']}]" if a['scaleX']246 skw = ",skw:[#{a['skewX'] },#{a['skewY']}]" if a['skewX']304 scl = ",scl:[#{a['scaleX'].to_f},#{a['scaleY'].to_f}]" if a['scaleX'] 305 skw = ",skw:[#{a['skewX'].to_f},#{a['skewY'].to_f}]" if a['skewX'] 247 306 end 248 307 … … 266 325 pid = ",id:#{tg.attributes['objectID']}" if tg.attributes['objectID'] != nil 267 326 268 "{tag:JSplash.tPlaceObject2#{pid},d:#{tg.attributes['depth']}#{cl}#{rep}#{mov}#{scl}#{skw}#{nm}#{cofs}#{cfct}}" 327 vflg = nil 328 vflg = ",v:#{v}" if v 329 330 "{tag:JSplash.tPlaceObject2#{vflg}#{pid},d:#{tg.attributes['depth']}#{cl}#{rep}#{mov}#{scl}#{skw}#{nm}#{cofs}#{cfct}}" 269 331 end 270 332 … … 299 361 300 362 def self.readDefineButton2(tg, nest, fi) 301 "{tag:JSplash.tDefineButton2,id:#{tg.attributes['objectID']}}" 363 buttons = tg.elements['./buttons'] 364 365 "{tag:JSplash.tDefineButton2,id:#{tg.attributes['objectID']},\n buttons:[\n#{read_buttons(buttons)}\n]}" 302 366 end 303 367 … … 345 409 elist.each {|tg| 346 410 $top_tag_index+=1 if nest==0 347 if tg.name == " Export" || tg.name == "DoInitAction"411 if tg.name == "DoInitAction" 348 412 STDERR.puts "ignored [#{tg.name}] at #{$top_tag_index}" 413 next 414 elsif tg.name == "Export" 415 TagReaders.readExport(tg, nest, findex) 349 416 next 350 417 elsif tg.name == "UnknownTag" && tg.attributes['id'].to_i(16) == 8 # JPEGTables … … 405 472 end 406 473 474 def dump_exports(map) 475 ret = [] 476 map.each{|k,v| 477 ret << "'#{k}':#{v}" 478 } 479 480 ret.join(',') 481 end 482 407 483 #---------------------------- 408 484 … … 457 533 f1.puts " header: {frameRate: #{swf.frame_rate}, frames: #{swf.frames}, width: #{swf.width}, height: #{swf.height}}," 458 534 f1.puts " bitmaps: [#{$bitmap_refs.map{|b| "{n:'#{b.id}.#{b.ftype}',w:#{b.width},h:#{b.height}}"}.join(',')}]," if $bitmap_refs 535 f1.puts " exports: {#{dump_exports($exports)}}," if $exports 459 536 f1.puts " taglist: [" 460 537 f1.puts tags_1.join(",\n")

