Ok, I am understanding things a little better I believe. Quick question to 
solidify some knowledge. In reference to my question about a private class, is 
the class CustomClient at the bottom an example of a private class? It was 
mentioned that even if you don't have the word private there and don't put 
public, flash automatically will interpret it as a private class. It is inside 
the class file but outside the package for the main class (which was also 
mentioned), it does not have public on it so you can't call it outside this 
file. This is what a private class is, correct? 

package {
    import flash.display.Sprite;
    import flash.events.NetStatusEvent;
    import flash.events.SecurityErrorEvent;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.events.Event;

    public class NetConnectionExample extends Sprite {
        private var videoURL:String = 
"http://www.helpexamples.com/flash/video/cuepoints.flv";;
        private var connection:NetConnection;
        private var stream:NetStream;
        private var video:Video = new Video();        

        public function NetConnectionExample() {
            connection = new NetConnection();
            connection.addEventListener(NetStatusEvent.NET_STATUS, 
netStatusHandler);
            connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, 
securityErrorHandler);
            connection.connect(null);
        }

        private function netStatusHandler(event:NetStatusEvent):void {
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
                    connectStream();
                    break;
                case "NetStream.Play.StreamNotFound":
                    trace("Stream not found: " + videoURL);
                    break;
            }
        }

        private function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }

        private function connectStream():void {
            addChild(video);
            var stream:NetStream = new NetStream(connection);
            stream.addEventListener(NetStatusEvent.NET_STATUS, 
netStatusHandler);
            stream.client = new CustomClient();
            video.attachNetStream(stream);
            stream.play(videoURL);
        }
    }
}

class CustomClient {
    public function onMetaData(info:Object):void {
        trace("metadata: duration=" + info.duration + " width=" + info.width + 
" height=" + info.height + " framerate=" + info.framerate);
    }
    public function onCuePoint(info:Object):void {
        trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + 
info.type);
    }
}

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to