svnno****@sourc*****
svnno****@sourc*****
2009年 12月 13日 (日) 00:00:46 JST
Revision: 1463 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1463 Author: dhrname Date: 2009-12-13 00:00:45 +0900 (Sun, 13 Dec 2009) Log Message: ----------- Modified Paths: -------------- branches/05x/056/sie.js Modified: branches/05x/056/sie.js =================================================================== --- branches/05x/056/sie.js 2009-12-12 14:50:53 UTC (rev 1462) +++ branches/05x/056/sie.js 2009-12-12 15:00:45 UTC (rev 1463) @@ -2252,21 +2252,11 @@ this.to = this.tar.getAttribute("to"); var offset = 0; try { - offset = this.getOffset(this.begin); - if ( /(mouse|activ|click)/.test(this.begin) ) { //イベントがある場合 - var tar; - if ( /\.\D/.test(this.begin) ) { - tar = this.tar.ownerDocument.getElementById( this.begin.substring(0, this.begin.indexOf(".")) ); - } else { - tar = this.target.tar; - } + this.eventSync(this.begin, (function(te, offse, ta) { ta.attachEvent( "on" + te.begin.match(/(mouse|activ|clic)[a-z]+/)[0], function(){te.beginElementAt(offse);}, false ); - })(this, offset, tar); - } else { - this.beginElementAt(offset); - } + }), "beginElementAt"); if (this.dur) { this.simpleDuration = this.getOffset(this.dur); } @@ -2302,6 +2292,19 @@ n = t = null; return offset; }; +STSetElement.prototype.eventSync = function(/*string*/ t, /*function*/ f, /*string*/ methodName) { + var offset = this.getOffset(t); + if ( /(mouse|activ|click)/.test(t) ) { //イベントがある場合 + var tar; + if ( /\.\D/.test(t) ) { + tar = this.tar.ownerDocument.getElementById( t.substring(0, t.indexOf(".")) ); + } else { + tar = this.target.tar; + } + f(this, offset, tar); + } else { + this[methodName](offset); + }}; //sは現在のフレーム数であることに気をつけること STSetElement.prototype._frame = function(/*int*/ s) { if (this._begin) { @@ -2404,22 +2407,12 @@ this.to = this.tar.getAttributeNS(null, "to"); var offset = 0; try { - offset = this.getOffset(this.begin); - if ( /(mouse|activ|click)/.test(this.begin) ) { //イベントがある場合 - var tar; - if ( /\.\D/.test(this.begin) ) { - tar = this.tar.ownerDocument.getElementById( this.begin.substring(0, this.begin.indexOf(".")) ); - } else { - tar = this.target.tar; - } + this.eventSync(this.begin, //クロージャを参照 (function(te, offse, ta) { ta.addEventListener( te.begin.match(/(mouse|activ|clic)[a-z]+/)[0], function(){te.beginElementAt(offse);}, false ); - })(this, offset, tar); - } else { - this.beginElementAt(offset); - } + }), "beginElementAt"); if (this.dur) { this.simpleDuration = this.getOffset(this.dur); }