現在のフレームを再生するのに苦労しています。私はswfobject ver 2.2を使用しています。事前にSWFOBJECT CurrentFrame Javascript
<script type="text/javascript">
function flashplayer(flashname) {
var flashvars = {};
var params = {};
params.play = "true";
params.menu = "true";
params.scale = "noscale";
params.allowfullscreen = "true";
var attributes = {
id: "flashDiv",
name: "flashDiv"
};
swfobject.embedSWF(flashname, "myAlternativeContent", "800", "600", "9.0.0", flashvars, params, attributes);
var obj = swfobject.getObjectById("myAlternativeContent");
totalFrames = obj.totalFrames;
$('#duration').html(totalFrames);
currentFrame1 = obj.currentFrame;
$('#current').html(currentFrame1);
obj.addEventListener("onStateChange", "onytplayerStateChange");
}
function onStateChange() {
var obj = swfobject.getObjectById("myAlternativeContent");
currentFrame1 = obj.TcurrentFrame;
$('#current').html(currentFrame1);
}
function stopflash() {
var obj = swfobject.getObjectById("myAlternativeContent");
obj.Stop();
}
function PlayFlash() {
var obj = swfobject.getObjectById("myAlternativeContent");
obj.Play();
}
function FlashRewind() {
var obj = swfobject.getObjectById("myAlternativeContent");
obj.Rewind();
}
</script>
<div id="duration">
1
</div>
<div id="current">
1
</div>
<input onclick="flashplayer('../../Video/test.swf');" type="button" style="width: 300px"
value="play flash" /><br />
ありがとう:
は、ここに私のスクリプトです。
ありがとう、var obj = event.ref;を使用しました。 このエラーが発生しました(Microsoft JScriptランタイムエラー:プロパティ 'totalFrames'の値を取得できません:オブジェクトはnullまたは未定義です)。私はそれを次のように変更しました:var obj = swfobject.getObjectById( "flashDiv");私は全体のフレームを取得しますが、再生中の現在のフレーム番号はまだありません。 – hncl
それは、私が私の記事の終わりに言及したタイミング問題のためです。 SWFの読み込みが完了していない場合は、TotalFramesを照会することはできません。 PercentLoadedを確認する条件文でクエリをラップします。また、TotalFramesは大文字のTで始まり、大文字と小文字を区別します。 obj.TotalFrames()http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html – pipwerks
を参照してくださいありがとうございました。それでも現在のフレーム番号を取得できませんでした。また、TotalFramesはFireFoxやChromeでは動作しませんでした。この投稿が見つかりました。ご協力いただきありがとうございます。 – hncl