A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Error message help

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    3

    Error message help

    HI, can anyone help me? I am new to using AS3, so I have a feeling that this will be an easily solved problem. I'm trying to play an flv. when I press the number 1 key.

    The code I have used is:

    sunvid.flvPlayer.stop();
    var ispaused = 0;
    stage.addEventListener(KeyboardEvent.KEY_UP, playfile);
    function playfile(e:KeyboardEvent):void {
    if (e.keyCode==Keyboard.(1) ){
    sunvid.flvPlayer.gotoAndPlay(2);
    }
    }

    the code apparently contains no errors but I keep getting this error message and I have no idea how to fix it!

    TypeError: Error #1123: Filter operator not supported on type class flash.ui.Keyboard.

    Any advice would be greatly appreciated!

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    I would do a trace inside of your function and see what the e.keyCode is:

    Code:
    stage.addEventListener(KeyboardEvent.KEY_UP, playfile);
    function playfile(e:KeyboardEvent):void {
    trace(e.keyCode)
    }
    when I press "1" on my keyboard, I get 52 in the output window.

    so the if statement would be something like this:
    Code:
    if(e.keyCode==52){
    //execute your code here
    }
    the other issue I can forsee is you are using a timeline command to try and control your flvPlayback component. If you want to play the flvPlayback, just use .play and NOT gotoAndPlay(2);

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    3

    Thank you for the help but i'm still having some problems

    Hi, thanks for the help, I get 49 in the output window.

    Maybe i'm still doing things wrong...

    I have an error message that says:

    1120: Access of undefined property e.

    The code i now have is:

    sunvid.flvPlayer.stop();
    var ispaused = 0;
    stage.addEventListener(KeyboardEvent.KEY_UP, playfile);
    function playfile(e:KeyboardEvent):void {
    trace(e.keyCode)
    }
    {
    if(e.keyCode==49){
    sunvid.flvplayer.play();
    }
    }

    it would be great if you could help me a little more please!

  4. #4
    Junior Member
    Join Date
    May 2013
    Posts
    3
    Hi, thanks for the help, I get 49 in the output window.

    Maybe i'm still doing things wrong...

    I have an error message that says:

    1120: Access of undefined property e.

    The code i now have is:

    sunvid.flvPlayer.stop();
    var ispaused = 0;
    stage.addEventListener(KeyboardEvent.KEY_UP, playfile);
    function playfile(e:KeyboardEvent):void {
    trace(e.keyCode)
    }
    {
    if(e.keyCode==49){
    sunvid.flvplayer.play();
    }
    }

    it would be great if you could help me a little more please!

  5. #5
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    The if statement needs to be inside your function...

    function playFile(e:keyboardEvent){
    //trace statement
    //if statement
    }

    Look at your opening and closing curly braces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center