Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
try this:
myClip.addEventListener(MouseEvent.CLICK, myFunc);
function myFunc():void{
var pos;
if (mouseY > 0 && mouseY <= 50 && mouseX > 0 && mouseX <= 500)
{
pos = mouseX / 500 * (MovieClip(parent)._totalframes - 40);
_parent.sBar.width = mouseX;
_parent.sBar.x = 0;
MovieClip(parent).gotoAndPlay(int(pos);
_global.paused = 1;
}
}
Copy link to clipboard
Copied
same error
Copy link to clipboard
Copied
well test this and tellme wath you need to do i atach this files: http://www.faraday.mx/testThis.rar
you want to do one player? somethink like this files? because the code wath you found do somethink like this atached files, and it works if you have video in time line you can goToAndStop();
in one especific frame. and made the width of the secBar from point x 0 to your mouse click.
is this wath you need to do?
Copy link to clipboard
Copied
What i need to do is like how this video has it set up
luckystarscattery.com/wizard.swf
(its invisible at the bottom when the video starts, hover over it for visibility)
So basically, Play and pause buttons (preferably as the same button) as well as the seekbar. (I need the play/pause to pause EVERYTHING including movie clips and audio)
Copy link to clipboard
Copied
hello here is the answer:
import flash.events.MouseEvent;
//we start the width of the bar around the number of frames of MC player in root
sBar.width = 500 * (MovieClip(parent).player.currentFrame / MovieClip(parent).player.totalFrames);
//start the parent Movieclip PLAYER as STOP
MovieClip(parent).player.stop();
//when click the bar check the values
this.addEventListener(MouseEvent.MOUSE_DOWN, myFunc);
//execute the function when click
function myFunc(e:MouseEvent):void{
if (mouseX > 0 && mouseY <= 50 && mouseX > 0 && mouseX <= 500)
{
var pos:Number = mouseX / 500 * (MovieClip(parent).player.totalFrames);
sBar.width = mouseX;
sBar.x = 0;
MovieClip(parent).player.gotoAndStop(int(pos));
//also we pause when move
MovieClip(root).infoTxt.text = "isPaused";
}
}
and i atached some files to you can learn about it:http://www.faraday.mx/player2.rar
about the sounds stop you can use:
import flash.media.SoundMixer;
SoundMixer.stopAll();
and for stop the movieclips you need to found it and use Movieclip.stop();
regards.
Copy link to clipboard
Copied
ok, now how do i make it so that works on the main timeline instead of within a movie clip?
Copy link to clipboard
Copied
hi, you need use like this:
inside the secBAR:
import flash.events.MouseEvent;
//we start the width of the bar around the number of frames of MC player in root
sBar.width = 500 * (MovieClip(root).currentFrame / MovieClip(root).totalFrames);
//start the Main timeLine as STOP
MovieClip(root).stop();
//trace("MC root->"+MovieClip(root));
//when click the bar check the values
this.addEventListener(MouseEvent.MOUSE_DOWN, myFunc);
//execute the function when click
function myFunc(e:MouseEvent):void{
if (mouseX > 0 && mouseY <= 50 && mouseX > 0 && mouseX <= 500)
{
var pos:Number = mouseX / 500 * (MovieClip(root).totalFrames);
sBar.width = mouseX;
sBar.x = 0;
MovieClip(root).gotoAndStop(int(pos));
//also we pause when move
MovieClip(root).infoTxt.text = "isPaused";
}
}
regards.
Copy link to clipboard
Copied
I couldn't get it to work, just got errors and when i got no errors then the Seekbar stopped working
Copy link to clipboard
Copied
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;
}
}
Copy link to clipboard
Copied
ok, now it works but the seekbar doesnt move as the video plays
Copy link to clipboard
Copied
you need add a Enterframe Event like this to update the secBar:
add this:
addEventListener(Event.ENTER_FRAME, moveWhilePlay);
function moveWhilePlay(e:Event):void{
secBarMC.sBar.width = 500 * (this.currentFrame / this.totalFrames);
}
Copy link to clipboard
Copied
that breaks it, after using that code it doesnt pause and loops forever. would you be able to post the FLA please?
Copy link to clipboard
Copied
hi sure here is the last fla it is working good as you want it can be more complex but i thing your request is alredy done
preview: http://www.faraday.mx/Adobe/Player/Player2.swf
fla: http://www.faraday.mx/Adobe/Player/Player2.fla
i think it's all all is answer..
regards.
Copy link to clipboard
Copied
It's Perfect. thank you