-
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!
-
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);
-
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!
-
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!
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|