PDA

View Full Version : Error message MouseEvent


JodieW
07-15-2008, 02:39 AM
Can someone please help me.

I am working with action script 2 and need to change this script from AC3 to AC2

import fl.video.VideoEvent;

function playMovie(event:MouseEvent):void {
myVideo.play();
}

function showPosterFrame(event:Event):void {
myPoster.visible = true;
}

function hidePosterFrame(event:Event):void {
myPoster.visible = false;
}

myPoster.addEventListener(MouseEvent.CLICK, playMovie);
myVideo.addEventListener(VideoEvent.PLAYING_STATE_ ENTERED, hidePosterFrame);
myVideo.addEventListener(VideoEvent.COMPLETE, showPosterFrame);

I keep getting error messages

The class or interface 'MouseEvent' could not be loaded.

luka66_6
09-21-2008, 08:09 PM
The class or interface 'MouseEvent' could not be loaded.

I get the same error message and i do have import flash.events.*; at the start of cede.Why is that?

regards

Sicontis
09-22-2008, 03:34 AM
Hi,

The code below is taken from the Flash help files but has been altered a little to show how best to approach what you need to do in AS2. There is no Mouse Events used here as the FLV player has it's own play controls. It requires that you have an FLVPlayback component on stage with an instance name of myFLVPlayer.


import mx.video.*;

myFLVPlayer.contentPath = "http://www.helpexamples.com/flash/video/water.flv";

var listenerObject:Object = new Object();
listenerObject.stateChange = function(eventObject:Object):Void
{
// Check for the PLAYING state of the FLV player
if(eventObject.state == FLVPlayback.PLAYING)
{
trace("Hide the poster frame");
}
// Check for the REWINDING state of the FLV player
if(eventObject.state == FLVPlayback.REWINDING)
{
trace("Show the poster frame");
}
}
myFLVPlayer.addEventListener("stateChange", listenerObject);


You can listen for the FLVPlayback.STOPPED state but what the FLV player does once a movie has reached the end is STOP, then REWIND, and then STOP again at the beginning of the movie to prevent it from playing. So you would actually get two STOP states returned. Using the FLVPlayback.REWINDING state means you'll get just one video state returned.

syedadeel2
06-13-2009, 05:34 PM
I get the same error message and i just fixed

here see now the code you are writing is AS3 but the publish setting is set for AS2.

to fix this problem you simply need to go to File > Publish Settings...

after that select "Flash Tab" and Select the ActionScript version to 3.0

and it will be fixed.

thank you

regards[/QUOTE]