Skip to main content
Participant
April 9, 2009
Question

FLVPlayback with Live Cam and Custom Skin

  • April 9, 2009
  • 1 reply
  • 860 views

Hello,

I am curretnly attempting to use Flash Media Server, Flash Media Encoder, and Flash CS3 to make a custom swf for the web that viewers can watch the live feed from and have basic play/stop controls. I have followed the helpful information found here, http://www.adobe.com/devnet/flashmediaserver/articles/beginner_live_fms3.html , and have a pretty good knowledge of CS2 so CS3 really isn't that big of an issue but I already have an error.

Error: TypeError: Error #1006: addListener is not a function. at live_fla::MainTimeline/frame1()

Code:

stop();
myVideo.isLive = true;

function  playVid(e:MouseEvent):void {
    myVideo.play();
}
function  stopVid(e:MouseEvent):void {
    myVideo.stop();
}
function fullScreen(e:MouseEvent):void {
    myVideo.enterFullScreenDisplayState();
}
playBtn.addListener(MouseEvent.CLICK, playVid);
stopBtn.addListener(MouseEvent.CLICK, stopVid);
fullscreenBtn.addListener(MouseEvent.CLICK, fullScreen);

I have a FLVPlayback component labeled myVideo in one layer. Above that I have a controls layer that contains three buttons: playBtn, stopBtn, fullscreenBtn. All of these have the proper instance names but for some reason I am getting that error. Any input would be appreciated. Also the live feed is streaming properly for me, its just that I get the error and the buttons do not work.

Also, instead of setting the source of the FLVPlayback component in parameters wouldnt it be possible to do myVideo.source(); ?

Thanks in advance.

Frank

    This topic has been closed for replies.

    1 reply

    Participant
    April 10, 2009

    I am still seeking assistance with this if anyone has any input.

    Participant
    April 11, 2009

    Alright. I was working on this and found out that addListener isnt supported in AS3 and it is now addEventListener. I continued to work with and seems there were just some AS3 errors as I am new to the AS3 code. They are fixed now and here is the new code.

    stop();
    myVideo.isLive = true;

    function  playVid(e:MouseEvent):void {
        myVideo.play();
        psBtn.stopBtn.alpha = 100;
        psBtn.playBtn.alpha = 0;
        psBtn.stopBtn.mouseEnabled = true;
        psBtn.playBtn.mouseEnabled = false;
        trace("step1");
    }
    function  stopVid(e:MouseEvent):void {
        myVideo.stop();
        psBtn.playBtn.alpha = 100;
        psBtn.stopBtn.alpha = 0;
        psBtn.stopBtn.mouseEnabled = false;
        psBtn.playBtn.mouseEnabled = true;
        trace("step2");
    }
    function fullScreen(e:MouseEvent):void {
        myVideo.enterFullScreenDisplayState();
        trace("step3");
    }
    psBtn.playBtn.addEventListener(MouseEvent.CLICK, playVid);
    psBtn.stopBtn.addEventListener(MouseEvent.CLICK, stopVid);
    fullscreenBtn.addEventListener(MouseEvent.CLICK, fullScreen);

    psBtn.playBtn.alpha = 100;
    psBtn.stopBtn.mouseEnabled = false;