AS2: Embedded video (clip) create a controlbar

  • Hybrid
  • Born
  • Born
  • Hybrid
  • Posts: 1

Post 3+ Months Ago

Hello,

I would douvrir this new discussion, because despite my research on the net, resource sites or tutorials, and this forum...I havent found a solution.

A few months ago jai made a Flash interface (designed to Loff-line), its a exe or app that is launched from a CD.
In this interface, there are videos that I chose to implement "integrated video" (for several reasons).

Javais already created buttons Play - Pause - Back to Top - Jump to the end to control the video.

Today, this video, i wish i could add a controlbar (or timeline bar). Cest to say, like any video player (or audio) to have a horizontal bar (representing the duration), and a button that advance (which is visually representative video over the entire duration).

The idea is to first just to see where we are in the video.
And 2nd, you can click this button to manually move the video.

The trick is for a classic video What ^ ^

I'm not a pro at programming...
Here is yet jarrive what to do.

For example, my onboard video is 2000 frames, and my timeline 800px.
So there is a report x2. 5

Code: [ Select ]
on(press) {
    startDrag(bille, false, 0, 400, 800, 400);
}
on(release) {
    stopDrag();
    //On récupère la position x de la bille
    this.bille._x;
    //On implante la position x de la bille dans une variable
    positionbille = bille._x;
    //On multiplie cette valeur au prorata du nombre de clé de la vidéo
    positionclip = positionbille * 2.5
    //On arrondi cette valeur pour avoir un nombre entier
    positionclip = Math.round(positionclip/100) * 100
    //Ce nombre correspond à la clé du clip de la vidéo
    _parent.COMFORT.gotoAndPlay(positionclip);
}
  1. on(press) {
  2.     startDrag(bille, false, 0, 400, 800, 400);
  3. }
  4. on(release) {
  5.     stopDrag();
  6.     //On récupère la position x de la bille
  7.     this.bille._x;
  8.     //On implante la position x de la bille dans une variable
  9.     positionbille = bille._x;
  10.     //On multiplie cette valeur au prorata du nombre de clé de la vidéo
  11.     positionclip = positionbille * 2.5
  12.     //On arrondi cette valeur pour avoir un nombre entier
  13.     positionclip = Math.round(positionclip/100) * 100
  14.     //Ce nombre correspond à la clé du clip de la vidéo
  15.     _parent.COMFORT.gotoAndPlay(positionclip);
  16. }




A priori, it seems to work...
On this point, I only manage a quà if / else, to put a gotoAndPlay if the movie is playing or gotoAndStop if the video is paused.
Well there cétait easiest ^ ^

But the most difficult tasks lie ahead, that automatically advance the ball on the timeline when the video is playing. And its where I hang.
(Jappelli that the ball is the button or slider)

In my thinking (maybe fake)...to the ball ahead of the timeline, it must recover linformation on what "key" is the video (eg 250), divide this value by 2.5 (so 100), and thus move the ball x 100px.

But I can not find how in AS2, you can retrieve linformation to-know-what-to-be-key-is-lanimation.

Because once this information back, just (I assume I'm) implement that value in a variable, and always with a nice rule of three, convert this value to indicate the ball position in which x must be found.

If you have any ideas, leads, suggestions or even a solution, thank you ;)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

For this you need to know the total time of the movie.
Code: [ Select ]
var timeTotal = 15; // total time of the movie, in seconds
var dragXStart = 0; // left most x position of the ball
var dragXEnd = 800; // right most x position of the ball

// this will return the time you have to set for your player, after you dragged the ball
function GetPlayTime()
{
var nPercent:Number = 100*(bille._x - dragXStart)/dragXEnd;
var nTime:Number = nPercent*timeTotal/100;
return Math.floor(nTime);
}

// so use it something like this:
on(release) {
var playerTime = GetPlayTime();
// netStream is the net stream you attached to your video; i.e.: my_video.attachVideo(netStream);
netStream.seek(playerTime);
}
  1. var timeTotal = 15; // total time of the movie, in seconds
  2. var dragXStart = 0; // left most x position of the ball
  3. var dragXEnd = 800; // right most x position of the ball
  4. // this will return the time you have to set for your player, after you dragged the ball
  5. function GetPlayTime()
  6. {
  7. var nPercent:Number = 100*(bille._x - dragXStart)/dragXEnd;
  8. var nTime:Number = nPercent*timeTotal/100;
  9. return Math.floor(nTime);
  10. }
  11. // so use it something like this:
  12. on(release) {
  13. var playerTime = GetPlayTime();
  14. // netStream is the net stream you attached to your video; i.e.: my_video.attachVideo(netStream);
  15. netStream.seek(playerTime);
  16. }

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.