开发者

Actionscript 3.0 Play and pause add effect

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')开发者_JAVA技巧;
        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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜