Need help on flv player

Hi…everyones…

here’s are the flv question again…just wanna asking u guys opinion why when i try to shift the timelien code to external class code it didnt play the video as suppose to…is soemethign wrong with the code…
//heres the frame based code …which is working ok and great…



stop();

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoContainer.attachVideo(ns);
ns.play("water.flv");


then I try to convert to class file…and here;s the class



class FlvPlayer{
    private var __theVid:String;
    private var nc:NetConnection;
    private var ns:NetStream;
    private var __videoContainer:Video;
    //constructor
    function FlvPlayer(thevid:String,videoContainer:Video){
        this.__theVid = thevid;
        this.__videoContainer = videoContainer;
        trace(typeof this.__videoContainer);
        init();
    }
    
    private function init():Void{
        var nc:NetConnection = new NetConnection();
        nc.connect(null);
        
        var ns:NetStream = new NetStream(nc);
        playVideo();
    }
    
    private function playVideo():Void{
        this.__videoContainer.attachVideo(ns);
        ns.play(this.__theVid);
    }
}


and in my flas…i just instantiate the class…


stop();

var myVid:FlvPlayer = new FlvPlayer("water.flv",videoContainer);

the the result is empty…the code does not playing the video lol…so whats wrong with this code…just wanna get insight before I can further coding the rest…thnks in advanced everyones…:slight_smile:

I’d advise you to keep that code in the flash file

also is it my imagine-nation but classes load into 1 level only, you have to reference everything from one level… as you should

hello pixeldude your class seemed to have a small problem …

you first made the net connection and netstream as private variables… but ended up creating local copies of them again in the init function.

so there was a scope referencing problem here :
ns.play(this.__theVid);

My suggestion to you… move towards external file based scripting…from #include to pure object oriented classes… thats the future… the faster you adapt … the sooner you will get in contact with actionscript 3.0

**randomagain:**I wish i can do that heheh…anyway thanks for ur time mate!!!

**sparkdemon:**My bad lol…must be overlooking…no wonder i cant call the ns object since I make it as local variable…anyway thanks to u mate… it work now…also thanks for ur support since Im also learning AS3 by try and error…

i have been on aviane for three months now and i dont want to get my peruiod this month because i’ll be on vacation. will i get my period if i skip the green pills (sugar pills) or will i have side effects? i knwo Womens Health your not supposed to do it but ti’s only a once ina while thing like 2 or 3 times a year