// Movie.tjs - ムービー再生 // Copyright (C)2001-2003, W.Dee 改変・配布は自由です class Movie extends VideoOverlay { var owner; var lastStatus = "unload"; // 直前のステータス var opened = false; function Movie(owner) { super.VideoOverlay(...); this.owner = owner; } function finalize() { if(lastStatus == "play") stop(); super.finalize(...); } function onStatusChanged(status) { // ステータスの変更があった if(lastStatus == "play" && status == "stop") { owner.onMovieStop(); // 停止 super.close(); } lastStatus = status; } function onCallbackCommand(cmd, arg) { // コールバックコマンド if(cmd == "Go") { var spos = arg.indexOf('/'); if(spos == -1) { // ストレージ指定がない owner.process('', '*' + arg); } else { // ストレージ指定がある var label = arg.substring(spos + 1); if(label != '') label = '*' + label; owner.process(arg.substring(0, spos), label); } } else if(cmd == "Eval") { arg!; } } property canWaitStop { getter { // 待てるかどうか return lastStatus == "play"; } } function open(storage) { // open オーバーライド try { super.open(storage); opened = true; } catch(e) { if(e.message.indexOf(".dll") != -1) throw e; dm("ムービー " + storage + " を再生できません : " + e.message); return; } } function play(storage) { // play オーバーライド try { if(!opened) super.open(storage); super.play(); opened = false; } catch(e) { if(e.message.indexOf(".dll") != -1) throw e; dm("ムービー " + storage + " を再生できません : " + e.message); return; } } function stop() { // stop オーバーライド super.stop(...); super.close(); } function setOptions(elm) { // elm からオプションを設定 visible = +elm.visible if elm.visible !== void; var l = left, t = top, w = width, h = height; var set = false; (set = true, l = +elm.left) if elm.left !== void; (set = true, t = +elm.top) if elm.top !== void; (set = true, w = +elm.width) if elm.width !== void; (set = true, h = +elm.height) if elm.height !== void; if(set) setBounds(l, t, w, h); } }