A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Placing cue point markers correctly

  1. #1
    Senior Member
    Join Date
    Oct 2008
    Posts
    179

    Placing cue point markers correctly

    So I have a video player with a playbar showing the current play time. I have added cue points like this:

    code:

    __VTODCuePoints = [
    {time:3,name:"firstCue"},
    {time:10,name:"secondCue"},
    {time:20,name:"thirdCue"},
    {time:35,name:"fourthCue"},
    {time:40,name:"fifthCue"},
    {time:67,name:"sixthCue"}
    ];
    for (var i:Number = 0; i < __VTODCuePoints.length; i++)
    {
    v.addASCuePoint(__VTODCuePoints[i].time,__VTODCuePoints[i].name);
    }



    Now on the playbar, I want to place a little dot at the second of the cue point. I am doing this so far:
    code:

    private function addCuePointsToTimeline():void
    {
    for (var i:Number = 0; i < __VTODCuePoints.length; i++)
    {
    var sec:Number = __VTODCuePoints[i].time;
    var cp:CuePointClip = new CuePointClip();
    cp.mouseEnabled = false;
    cp.y = 27;
    cp.x = sec;
    __big_timeline.addChild(cp);
    }
    }



    Now that is placing them on the timeline which is good, however, cp.x is not right. It is placing the dots at the value of the time in the VTODCuePoint array. I need to figure out where they need to go relative to the width of the playbar. Its probably pretty simple, but I am blanking right now and cant think of it. Any ideas?

  2. #2
    Junior Member
    Join Date
    Jul 2007
    Posts
    16
    I think you need to set cp relative to the time of video total time
    I need to see your playbar in order to be sure,but I think this code will do it
    cp.x=playbar.x+(sec\video total time)

  3. #3
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Aaziz is on the right track but you also need to factor in the length of the playbar (otherwise the dots would be spread over a range of 0–1px at the beginning of the bar):

    playbar.x + ((sec/video total time) * playbar.width);

  4. #4
    Senior Member
    Join Date
    Oct 2008
    Posts
    179
    ahh thanks guys that worked!
    code:

    cp.x = ((sec /__thumbVideoLength) * __big_timeline["timelinewidth"].width);



    I didnt have to include the playbar.x because it starts at 0 anyway, but thats the code and they land right on the dot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center