チェンジセット 1619
- コミット日時:
- 2008/10/14 23:53:32 (3 年前)
- ファイル:
-
- ruby/jsplash/trunk/client2/demo_20081001.xml (更新) (1 diff)
- ruby/jsplash/trunk/client2/index.xml (更新) (1 diff)
- ruby/jsplash/trunk/client2/jsplash/objects.js (更新) (15 diffs)
- ruby/jsplash/trunk/client2/jsplash/player.js (更新) (4 diffs)
- ruby/jsplash/trunk/client2/jsplash/swfglobal.js (更新) (2 diffs)
- ruby/jsplash/trunk/client2/rocket_demo.xml (更新) (1 diff)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
ruby/jsplash/trunk/client2/demo_20081001.xml
r1579 r1619 56 56 <p id="statusout"> </p> 57 57 <p>playing on javascript with JSplash</p> 58 <p id="sout">starting <em>JSplash Player 0.4.1 0</em>...<br />-------------------------------------<br /></p>58 <p id="sout">starting <em>JSplash Player 0.4.12</em>...<br />-------------------------------------<br /></p> 59 59 <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 60 60 </svg> ruby/jsplash/trunk/client2/index.xml
r1616 r1619 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 1<br />-------------------------------------<br /></p>56 <p id="sout"><em>JSplash Player</em> 0.4.12<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/objects.js
r1616 r1619 47 47 this.overridden = false; 48 48 this.dynamic = false; 49 this.dynDepthBase = null; 49 50 50 51 this.mousePos = {x:0, y:0}; … … 201 202 if (this.depthMap[depth] != po) 202 203 { 204 if (this.depthMap[depth] && this.depthMap[depth].klass.classId == 4) console.log(depth); 203 205 this.removeObject(depth); 204 206 } … … 352 354 var o = this.pickPlacedObjectAt(depth); 353 355 354 if (o )356 if (o && !o.dynamic) 355 357 { 358 //if (o.klass.classId == 4) console.log(arguments.callee.caller); 356 359 //if (this.clipMap[depth]) 357 360 // this.applyAClip(depth, this.clipMap[depth], false); … … 559 562 var vlist = this.klass.getVarList(); 560 563 561 var handler = this.getProxy().onEnterFrame; 564 var P = this.getProxy(); 565 var handler = P.onEnterFrame; 562 566 if (handler) { 563 567 … … 565 569 handler._ai_ = new JSplash.ActionInstance(handler); 566 570 571 P.__mapGlobal__(); 567 572 this.execScript(handler._ai_, vlist, this.getProxy().onEnterFrame_env); 573 P.__unmapGlobal__(); 568 574 } 569 575 570 576 // next, check mousedown 571 577 if (JSplash.gPlayer.stage.mouse_down) { 572 handler = this.getProxy().onMouseDown;578 handler = P.onMouseDown; 573 579 if (handler) { 574 580 if (!handler._ai_) 575 581 handler._ai_ = new JSplash.ActionInstance(handler); 576 582 583 P.__mapGlobal__(); 577 584 this.execScript(handler._ai_, vlist); 578 } 585 P.__unmapGlobal__(); 586 } 587 } 588 }, 589 590 doDynamicAction: function(name) { 591 if (!this.klass) 592 return; 593 var vlist = this.klass.getVarList(); 594 595 var P = this.getProxy(); 596 var handler = P[name]; 597 if (handler) { 598 599 if (!handler._ai_) 600 handler._ai_ = new JSplash.ActionInstance(handler); 601 602 P.__mapGlobal__(); 603 this.execScript(handler._ai_, vlist); 604 P.__unmapGlobal__(); 579 605 } 580 606 }, … … 726 752 P._xscale != T.sx || P._yscale != T.sy || 727 753 P._rotation != T.r) { 728 T.mx = P._x ;729 T.my = P._y ;730 T.sx = P._xscale / 100.0;731 T.sy = P._yscale / 100.0;754 T.mx = P._x || 0; 755 T.my = P._y || 0; 756 T.sx = (P._xscale==undefined) ? 1 : (P._xscale / 100.0); 757 T.sy = (P._yscale==undefined) ? 1 : (P._yscale / 100.0); 732 758 T.r = P._rotation; 733 759 … … 749 775 P._rotation = T.r; 750 776 777 if (!this.is_stage) 778 this.setMousePos(); 751 779 P._xmouse = this.mousePos.x; 752 780 P._ymouse = this.mousePos.y; … … 758 786 759 787 this.putViewSize(P); 788 }, 789 790 setMousePos: function() { 791 var o = this; 792 var ox = 0; 793 var oy = 0; 794 795 for (;;) { 796 ox -= o.pxTransform.mx; 797 oy -= o.pxTransform.my; 798 799 o = o.parent; 800 if (o.is_stage) { 801 this.mousePos.x = o.mousePos.x - ox; 802 this.mousePos.y = o.mousePos.y - oy; 803 return; 804 } 805 } 760 806 }, 761 807 … … 791 837 for (var i = 0;i < len;i++) { 792 838 var b = list[i]; 793 // console.log(b.st);794 if (b.st == 8)795 continue; // don't place hitArea sprite796 839 797 840 var po = this.placeObject(1+i, b.id, undefined, undefined, 0, false, false); … … 800 843 if ((b.st&2) != 0) po.addStyleClass("jsplash-btn-over"); 801 844 if ((b.st&4) != 0) po.addStyleClass("jsplash-btn-down"); 845 if (b.st == 8) po.addStyleClass("jsplash-hitarea"); 802 846 } 803 847 } … … 806 850 { 807 851 Event.observe(this.g, "mouseup", this.onMouseUp.bind(this)); 852 Event.observe(this.g, "mousedown", this.onPress.bind(this)); 808 853 this.listeningMouse = true; 809 854 } … … 811 856 this.showFrame(); 812 857 }, 813 858 814 859 onMouseUp: function() { 860 JSplash.gPlayer.unregisterDraggingObject(this.instance_uid); 861 this.doDynamicAction("onRelease"); 815 862 this.doHandlerAction("on_release"); 863 }, 864 865 onPress: function() { 866 JSplash.gPlayer.registerDraggingObject(this.instance_uid, this); 867 this.doDynamicAction("onPress"); 868 }, 869 870 releaseOutside: function() { 871 this.doDynamicAction("onReleaseOutside"); 816 872 }, 817 873 … … 847 903 }, 848 904 905 calcDynDepth: function() { 906 var tags = this.taglist; 907 var len = tags.length; 908 var d = 1; 909 for (var i = 0;i < len;i++) { 910 if (tags[i].d && tags[i].d>d) 911 d = tags[i].d; 912 } 913 914 this.dynDepthBase = d + 1; 915 }, 916 849 917 attachMovie: function(id, inst_name, depth) { 850 var inst = this.placeObject(depth, JSplash.gPlayer.stage.lookupExportedSymbol(id), inst_name, undefined, false, false, false); 918 if (this.dynDepthBase == null) 919 this.calcDynDepth(); 920 921 var inst = this.placeObject(this.dynDepthBase+depth, JSplash.gPlayer.stage.lookupExportedSymbol(id), inst_name, undefined, false, false, false); 851 922 inst.dynamic = true; 852 923 this.executor.processAdditionalSprites(); … … 978 1049 }, 979 1050 1051 __mapGlobal__: function() { 1052 window._xmouse = this._xmouse; 1053 window._ymouse = this._ymouse; 1054 }, 1055 1056 __unmapGlobal__: function() { 1057 delete window._xmouse; 1058 delete window._ymouse; 1059 }, 1060 980 1061 __setChidrenRefs__: function() { 981 1062 var m = this.owner.nameMap; … … 995 1076 if (!this.onMouseDown) 996 1077 this.onMouseDown = null; 1078 if (!this.onPress) 1079 this.onPress = null; 1080 if (!this.onRelease) 1081 this.onRelease = null; 997 1082 }, 998 1083 ruby/jsplash/trunk/client2/jsplash/player.js
r1616 r1619 15 15 JSplash.gPlayer = this; 16 16 17 this.draggingObjects = {}; 17 18 this.executor = new JSplash.Executor(); 18 19 this.executor.frameRate = swf.frameRate; … … 38 39 svg.addEventListener("mousemove", this.onTopMouseMove.bind(this, svg), false); 39 40 svg.addEventListener("mousedown", this.onTopMouseDown.bind(this), false); 41 document.getElementsByTagName("body")[0].addEventListener("mouseup", this.onGlobalMouseUp.bind(this), false); 40 42 41 43 JSplash.SWFGlobals.setup(this); … … 83 85 delete Object.prototype.addProperty; 84 86 }, 87 88 unregisterDraggingObject: function(uid) { 89 if (this.draggingObjects[uid]) 90 delete this.draggingObjects[uid]; 91 }, 92 93 registerDraggingObject: function(uid, obj) { 94 this.draggingObjects[uid] = obj; 95 }, 96 97 onGlobalMouseUp: function(e) { 98 var map = this.draggingObjects; 99 for (var i in map) 100 { 101 map[i].releaseOutside(); 102 delete map[i]; 103 } 104 }, 85 105 86 106 onTopMouseDown: function(e) { … … 136 156 document.styleSheets[0].insertRule(".jsplash-btn-down{visibility:hidden;}", 0); 137 157 document.styleSheets[0].insertRule(":active>.jsplash-btn-down{visibility:visible;}", 0); 158 159 document.styleSheets[0].insertRule(".jsplash-hitarea{opacity:0; cursor:pointer;}", 0); 138 160 139 161 var swf = new JSplash.SWF(JSplash.swfdata); ruby/jsplash/trunk/client2/jsplash/swfglobal.js
r1616 r1619 15 15 g.SharedObject = JSplash.SWFGlobals.SharedObject; 16 16 g.Sound = JSplash.SWFGlobals.Sound; 17 g.Mouse = JSplash.SWFGlobals.Mouse; 17 18 g.__inherit__ = JSplash.SWFGlobals.inheritClass; 18 19 } … … 30 31 } 31 32 33 JSplash.SWFGlobals.Mouse = { 34 hide: function() { 35 }, 36 37 show: function() { 38 } 39 } 40 32 41 JSplash.SWFGlobals.inheritClass = function(base, subcls) { 33 Object.extend(subcls.prototype, base.prototype); 42 43 for (var p in base.prototype) 44 { 45 if (!subcls.prototype[p]) 46 subcls.prototype[p] = base.prototype[p]; 47 else 48 subcls.prototype["super_"+p] = base.prototype[p]; 49 } 50 // throw "hoge"; 51 // Object.extend(subcls.prototype, base.prototype); 52 // Object.extend(subcls.prototype, overrides); 34 53 35 subcls.prototype._super = base.prototype;36 54 subcls.prototype.__super__ = base; 37 55 subcls.prototype.super_ctor = function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){ 38 56 var so = new this.__super__(a,b,c,d,e,f,g,h,i,j,k,l,m,n); 39 Object.extend(so, this); 57 58 for (var q in so) 59 { 60 if (so[q] != this.__super__.prototype[q]) 61 this[q] = so[q]; 62 } 40 63 }; 41 64 } ruby/jsplash/trunk/client2/rocket_demo.xml
r1579 r1619 56 56 <p id="statusout"> </p> 57 57 <p>playing on javascript with JSplash</p> 58 <p id="sout">starting <em>JSplash Player 0.4.1 0</em>...<br />-------------------------------------<br /></p>58 <p id="sout">starting <em>JSplash Player 0.4.12</em>...<br />-------------------------------------<br /></p> 59 59 <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 60 60 </svg>

