0

XML ドキュメントから動的に読み込まれるキューポイントがあります。

    <cuepoints>
        <one name="bullet1" time="4.000" type="actionscript" said="Konnektivität"></one>
        <two name="bullet2" time="6.500" type="actionscript" said="Internet"></two>
        <three name="bullet3" time="7.500" type="actionscript" said="Bilder und Video"></three>
        <four name="bullet4" time="9.000" type="actionscript" said="Gaming"></four>
        <five name="bullet5" time="10.000" type="actionscript" said="Akkulaufzeit"></five>
    </cuepoints>

これが私のAS2コードです:

import mx.transitions.Tween;
import mx.transitions.easing.*;

//var playback1:mx.video.FLVPlayback;

/*////////////////////////////////////////////////////////////////
Load the video content paths
/////////////////////////////////////////////////////////////////*/
playback1.contentPath = getNodeValue(findNode(videos, "one"));

//turn off the visibilit of the bullet mc
bullet_bg._alpha = 0;
bullet_one._alpha = 0;
bullet_two._alpha = 0;
bullet_three._alpha = 0;
bullet_four._alpha = 0;
bullet_five._alpha = 0;

// Assign the mySeekBar instance to the flvPlayback instance
playback1.playPauseButton = playpause;
playback1.backButton = myrewind;
playback1.seekBar = seekbar_container.myseek;
playback1.bufferingBar = mybuffer; 

/*////////////////////////////////////////////////////////////
Create the Cuepoints for the video
///////////////////////////////////////////////////////////*/
var bullet1:Object = new Object();
bullet1.time = findNode(cuepoints, "one").attributes.time;
bullet1.name = findNode(cuepoints, "one").attributes.name; 
bullet1.type = "actionscript";

var bullet2:Object = new Object();
bullet2.time = findNode(cuepoints, "two").attributes.time;
bullet2.name = findNode(cuepoints, "two").attributes.name; 
bullet2.type = "actionscript";

var bullet3:Object = new Object();
bullet3.time = findNode(cuepoints, "three").attributes.time;
bullet3.name = findNode(cuepoints, "three").attributes.name; 
bullet3.type = "actionscript";

var bullet4:Object = new Object();
bullet4.time = findNode(cuepoints, "four").attributes.time;
bullet4.name = findNode(cuepoints, "four").attributes.name; 
bullet4.type = "actionscript";

var bullet5:Object = new Object();
bullet5.time = findNode(cuepoints, "five").attributes.time;
bullet5.name = findNode(cuepoints, "five").attributes.name; 
bullet5.type = "actionscript";


playback1.addASCuePoint(bullet1);
playback1.addASCuePoint(bullet2);
playback1.addASCuePoint(bullet3);
playback1.addASCuePoint(bullet4);
playback1.addASCuePoint(bullet5);


/*///////////////////////////////////////////////////////////
 CUE POINT LISTENER
///////////////////////////////////////////////////////////*/
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object) {
    var cuePtName = eventObject.info.name;
    if (cuePtName == "bullet1") {
        var b1:Tween = new Tween(bullet_one, "_alpha", Strong.easeInOut, 0, 100, 1, true);
        var b1x:Tween = new Tween(bullet_one, "_x", Strong.easeInOut, 100, 115, 1, true);
        trace(bullet1.time);
    }
    if (cuePtName == "bullet2") {
        var b2:Tween = new Tween(bullet_two, "_alpha", Strong.easeInOut, 0, 100, 1, true);
        var b2x:Tween = new Tween(bullet_two, "_x", Strong.easeInOut, 100, 115, 1, true);
        trace(bullet2.time);
    }
    if (cuePtName == "bullet3") {
        var b3:Tween = new Tween(bullet_three, "_alpha", Strong.easeInOut, 0, 100, 1, true);
        var b3x:Tween = new Tween(bullet_three, "_x", Strong.easeInOut, 100, 115, 1, true);
        trace(bullet3.time);
    }
    if (cuePtName == "bullet4") {
        var b4:Tween = new Tween(bullet_four, "_alpha", Strong.easeInOut, 0, 100, 1, true);
        var b4x:Tween = new Tween(bullet_four, "_x", Strong.easeInOut, 100, 115, 1, true);
        trace(bullet4.time);
    }
    if (cuePtName == "bullet5") {
        var b5:Tween = new Tween(bullet_five, "_alpha", Strong.easeInOut, 0, 100, 1, true);
        var b5x:Tween = new Tween(bullet_five, "_x", Strong.easeInOut, 100, 115, 1, true);
        trace(bullet5.time);
    }
}

/*/////////////////////////////////////////////
//// LISTENERS for FLVPlayback component
////////////////////////////////////////////*/ 
var alreadyShown:Boolean;

var startObject:Object = new Object();
startObject.playing = function(eventObject:Object): Void {   
    trace("FLV is playing");
    if(alreadyShown != true) {
        var laserFadeIn:Tween = new Tween(bullet_bg, "_alpha", Strong.easeInOut, 0, 100, 3.4, true);
        alreadyShown = true;
    } 
}

playback1.addEventListener("cuePoint", listenerObject);
playback1.addEventListener("playing", startObject);

問題は、何らかの理由で「10.000」秒の時間が経過すると、キューポイントの順序が狂ってしまい、すべて同時に表示されることです。時刻の形式に何か問題がありますか?

更新: 10.000 秒をハードコーディングすると、すべて正常に動作します。何か案は?

4

1 に答える 1

1

あなたが抱えている問題はtime、キューポイントのプロパティをstringsではなくに設定しているためだと思いますnumbersint次のように、キューポイントに割り当てる前に、XMLから取得した値をに変換してみてください。

var bullet1:Object = new Object();
bullet1.time = parseInt(findNode(cuepoints, "one").attributes.time);
bullet1.name = findNode(cuepoints, "one").attributes.name; 
bullet1.type = "actionscript";
于 2012-08-02T14:06:36.023 に答える