Skip to main content
Known Participant
December 15, 2013
Question

How to pause external vdos to play it again after played another vdo

  • December 15, 2013
  • 1 reply
  • 529 views

Hey! I have a question.

I have many external vdos which I have loaded and randomly play them once at a time by press some keyboard buttons.

Let's give vdos named a,b,c,... and picture this....

When people press a button a vdo A is playing then someone press another button or the same button the vdo B will be played immediately.

The same thing happen to vdo B if someone press any button on keyboard to play vdo C. After every vdo has been played, the program will set all the vdos back so people can play it again now but, I do want it to play in exact same point where it left.

Right now, my code can ramdomly play all the vdo without repeat them untill it plays them all. But I know because I REMOVE the vdo out so that's why the program don't play it again like this: var NewStore:Array = VdoStore.splice(i,1);

I think this way can't make a program to remember the vdo's timeline. But I don't know whatelse can I do to do what I want.

Anyway,

Someone tell me to try out some index to the array and add ++ after playing. Then after index is more than Array's length, just reset index to 0 again.

So...Any suggestion on how to pause many external vdos??

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 15, 2013

use the shuffle function to randomize your videos and then play from index = 0 to index=videoA.length-1:

function shuffle(a:Array) {

    var p:int;

    var t:*;

    var ivar:int;

    for (ivar = a.length-1; ivar>=0; ivar--) {

        p=Math.floor((ivar+1)*Math.random());

        t = a[ivar];

        a[ivar] = a

;

        a

= t;

    }

}

Known Participant
December 15, 2013

I don't get it. Does the code do the pause thing too or only random?  If it can pause the vdos, how come?Could you explain the code to me? thanks. :}

kglad
Community Expert
Community Expert
December 15, 2013

it randomizes your array of videos without changing the array (like you're doing) after it's randomized.  so, you can maintain your list of randomized videos.