Skip to main content
Known Participant
April 5, 2010
Answered

This will be the easiest one you answer: Disappearing play button on video

  • April 5, 2010
  • 1 reply
  • 3037 views

OK, all I want to do is this:

  • Create a flash video player using standard skin and play button image (video still and button) over center of video (YouTube style)
  • Want still and button to disappear when someone clicks play (in player skin or play button image)
  • Want video to play when someone clicks play button image

I used to do this all the time but it's been years and I've forgotten. All the tutorials I've found do this a little differently. I'd prefer to use AS3 for this.

Please help.

This topic has been closed for replies.
Correct answer kglad

Not working

I removed the space in pla yF. Same thing, button disappears, movie does not play:

TypeError: Error #1010: A term is undefined and has no properties.
    at newsemfinal30_Scene1_fla::MainTimeline/init()[newsemfinal30_Scene1_fla.MainTimeline::frame1:8]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at SetIntervalTimer/onTimer()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
TypeError: Error #1010: A term is undefined and has no properties.
    at newsemfinal30_Scene1_fla::MainTimeline/playF()[newsemfinal30_Scene1_fla.MainTimeline::frame1:14]

Here's the code with line numbers

1 playBtn.addEventListener(MouseEvent.CLICK,playF);

2

3

4 setTimeout(init,1000);

5

6
7 function init() {
8    semVideo.ctrlSemVideo.semVideo.playButton.addEventListener(MouseEvent.CLICK,playF);
9}

10

11
12 function playF(e:Event) {
13  playBtn.visible=false;
14    semVideo.ctrlSemVideo.semVideo.play();
15 }


then you're doing something incorrectly.

here's your working file:  www.kglad.com/Files/forums/newsemfinal30.fla

1 reply

kglad
Community Expert
Community Expert
April 5, 2010

assign your custom play button a name (eg playBtn),  assign your component and instance name (eg flv) and use:

playBtn.addEventListener(MouseEvent.CLICK,playF);

flv.playButton.addEventListener(MouseEvent.CLICK,playF);


function playF(e:Event){

playBtn.visible=false;

flv.play("yourflv.flv");

}

sholditchAuthor
Known Participant
April 5, 2010

Thanks a bunch for replying. I've embedded the video, converted to a MovieClip, and n

amed it semVid. Converted image to btn and named it playBtn

Let me know if this is right (I'll be testing at same time)

playBtn.addEventListener(MouseEvent.CLICK,playF);

semVid.playButton.addEventListener(MouseEvent.CLICK,playF);

function  playF(e:Event){

playBtn.visible=false;

semVid.play("your.flv"); // What is this line about? Do I need it if vid file is imported from local?

}

Got these error messages with this script:

1120: Access of undefined property semVid.

OK, fixed that but now get this:

1137: Incorrect number of arguments.  Expected no more than 0.

OK, removed anything from that last line so it now reads

semVid.play();

Get this error message:

TypeError: Error #1010: A term is undefined and has no properties.
    at newsemfinal30_fla::MainTimeline/frame1()

Button disappears but video does not play. Is this because I am using a FLVPlayback skin? Really stumped and hate being stumped on something that appears to be very simple.

kglad
Community Expert
Community Expert
April 5, 2010

you didn't:

"Create a flash video player using standard skin and play button image  (video still and button) over center of video (YouTube style)"

to do that, start over, add an flvplayback component to your fla etc