0
votes

layer 1 --> an embeded video
layer 2 --> an invisible button

**Here is my code in layer 3**

stop();

var vid:Boolean = true;

function vid_event(event:MouseEvent) {
    if (vid) {
        stop();
        event.target.gotoAndStop('pause');
        vid = false;
    } else {
        play();
        event.target.gotoAndStop('play');
        vid = true;
    }
}

vid_btn.addEventListener(MouseEvent.CLICK,vid_event);

I already get the play and pause function (that's all I need). I just want to add an image to show when the video still not playing in and pause. If the video played the image will disappear and if pause the image will appear.

1

1 Answers

0
votes

Based on your use of the term "layer," I gather you're developing in the Flash application, not Flex or the open-source SDK. I'm not super-familiar with Flash, but the general shape of the solution will be for you to create a DisplayObject containing your image (either a Shape or a Bitmap, depending on whether you're using a vector or raster graphics). Call addChild(myNewDisplayObject) to add it on pause, then removeChild(myNewDisplayObject) to remove it. I -think- that your Layer object should have these methods; I'm not sure, though, and I don't have Flash in front of me.