Skip to main content
Inspiring
May 2, 2009
Question

1046: Type was not found or was not a compile-time constant: VideoEvent.

  • May 2, 2009
  • 1 reply
  • 4617 views

I'm getting this error, and have imported the class, so I've no idea why.

Here's a code snippet:

import fl.video.*;

var myVideo:NetConnection = new NetConnection;
myVideo.connect(null);
var newStream:NetStream = new NetStream(myVideo);

videoHolder.attachNetStream(newStream);
newStream.play("myvideo.flv");

videoHolder.addEventListener(VideoEvent.BUFFERING_STATE_ENTERED, onPlayerNotBuffered);
videoHolder.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, onPlayerBuffered);

function onPlayerBuffered(e:VideoEvent) {
    newStream.resume();
    loader_txt.text = "";
}

function onPlayerNotBuffered(e:VideoEvent) {
    newStream.pause();
    loader_txt.text = "Buffering...";
}

Any help would be appreciated!

This topic has been closed for replies.

1 reply

Inspiring
May 2, 2009

The VideoEvent is dispatched by the FLVPlayback component, and I'm pretty sure you would need one of those in the library to be able to use it in code.

The Video class will not dispatch these events in any case.

The FLVPlayback component dispatches these events based on what is/has happened with its internal NetStream(s)

If you are new to video in flash then you are probably going to find the FLVPlayback component the easiest way to accomplish your goals.

Using a Video object with your own NetConnection/NetStream will get you a much smaller swf, but you need to do quite a bit more coding to cover off playback controls etc.

webby7097Author
Inspiring
May 2, 2009

Hmm. I can do everything else I need to with my video without using FLVPlayback.

Is there a way to buffer a netstream, without having to use FLVPlayback?

kglad
Community Expert
Community Expert
May 2, 2009

the video class doesn't dispatch a videoevent (and i assume videoHolder is a video instance).

the netstream class has a netStatus event and that event has an info property that has what you need.  check the netStatus event under the netstream class and check the netstatusevent for its info property.