Skip to main content
Participating Frequently
April 19, 2014
Question

How do i make a flash timeline seekbar using AS3?

  • April 19, 2014
  • 1 reply
  • 1928 views

I have found some ways of making this using AS2 but i need it to work for AS3. does anyone kow how or how files to do as such? (also, when paused i want the video to pause EVERYTHING including movie clips)

this is the AS2 Seekbar code that i have found

onClipEvent(mouseDown)

{

    var pos;

    if (_ymouse > 0 && _ymouse <= 50 && _xmouse > 0 && _xmouse <= 500)

    {

        pos = _xmouse / 500 * (_root._totalframes - 40);

        _parent.sBar._width = _xmouse;

        _parent.sBar._x = 0;

        _root.gotoAndPlay(int(pos));

        _global.paused = 1;

    }

}

This topic has been closed for replies.

1 reply

faraday1987
Participating Frequently
April 19, 2014

hi, you can try this:

myClip.addEventListener(MouseEvent.CLICK, myFunc);

function myFunc():void{

 

    var pos;

    if (_ymouse > 0 && _ymouse <= 50 && _xmouse > 0 && _xmouse <= 500)

    {

        pos = _xmouse / 500 * (_root._totalframes - 40);       

        _parent.sBar._width = _xmouse;

        _parent.sBar._x = 0;

                         MovieClip(parent).gotoAndPlay(int(pos);

        _global.paused = 1;

    }

 

}

or share the code to changue to AS3

regards.

Participating Frequently
April 19, 2014

I got the Expecting rightparen before semicolon line 23 error using that

also, i found this in the actionscript2

onClipEvent(mouseDown)

{

    var pos;

    if (_ymouse > 0 && _ymouse <= 50 && _xmouse > 0 && _xmouse <= 500)

    {

        pos = _xmouse / 500 * (_root._totalframes - 40);

        _parent.sBar._width = _xmouse;

        _parent.sBar._x = 0;

        _root.gotoAndStop(int(pos));

        _global.paused = 1;

    }

}

Participating Frequently
April 19, 2014

are you changue the code in the main timeline like this about the sources wath i alredy send to you?

import flash.events.Event;

//start the player paused

infoTxt.text = "isPaused";

//events of the player buttons

nextfr.addEventListener(MouseEvent.MOUSE_DOWN, nextFramePlay);

prevfr.addEventListener(MouseEvent.MOUSE_DOWN, prevFramePlay);

playStop.addEventListener(MouseEvent.MOUSE_DOWN, playPause);

//Next frame when click next and rezise the bar

function nextFramePlay(e:MouseEvent):void

{

          nextFrame();

          secBarMC.sBar.width = 500 * (this.currentFrame / this.totalFrames);

 

}

//Next frame when click prev and rezise the bar

function prevFramePlay(e:MouseEvent):void

{

          prevFrame();

          secBarMC.sBar.width = 500 * (this.currentFrame / this.totalFrames);

 

}

//Play button check if is play pause and if is paused play. is toggled button

function playPause(e:MouseEvent):void

{

          trace(infoTxt.text);

          switch(infoTxt.text)

          {

                    case "isPaused":

                              play();

                              infoTxt.text = "isPlay";

                    break;

                    case "isPlay":

                              stop();

                    infoTxt.text = "isPaused";

                    break;

 

          }

 

 

}


ok, now it works but the seekbar doesnt move as the video plays