netstream audio plays while video loading!

By diggz | Jan 14, 2009

actionscript3

hi all,

just managed to work out how to get flv’s to load up dynamically using xml - it all works well apart from this one problem that i have.

when the thumbnail for the flv is clicked the preloader appears and the flv starts to load - but for some reason the audio begins to play almost immediately - then when the flv actually loads then the audio plays again whilst the initial (unwanted) audio carries on playing!

this is the script for the netstream:

PHP Code:


                    private function onInitialize():void

            
{

                
_connection = new NetConnection();

                
_connection.addEventListener(NetStatusEvent.NET_STATUSonConnectionNetStatusfalse0true);

                
_connection.addEventListener(SecurityErrorEvent.SECURITY_ERRORonConnectionErrorfalse0true);

                
_connection.addEventListener(AsyncErrorEvent.ASYNC_ERRORonConnectionErrorfalse0true);

                
_connection.addEventListener(IOErrorEvent.IO_ERRORonConnectionErrorfalse0true);

                
_connection.objectEncoding ObjectEncoding.DEFAULT;

                
_connection.client = {

                    
onBWDoneonBWDone

                
};

                
//_connection.connect(”rtmp://yourfmshere/”);

                
_connection.connect(null);

            }

            

                        private function onConnectionError(…args):void

            
{

                
trace(“Test.onConnectionError()”);

            }

            

            private function 
onConnectionNetStatus(event:NetStatusEvent):void

            
{

                

                
trace(“**** code **** ” event.info.code);

                switch (
event.info.code)

                {

                    case 
“NetConnection.Connect.Success”:

                        
_stream = new NetStream(_connection);

                        
_stream.client = {

                            
onMetaDataonMetaData,

                            
onCuePointonCuePoint

                        
};

                        

                        
_video = new Video();

                         
_video.smoothing true;

                        
addChild(_video);

    

                        
_video.attachNetStream(_stream);

                            var 
xscaler:Number = (_video.width) * stage.stageWidth;

                            var 
yscaler:Number = (_video.height) * stage.stageHeight;

                                
_video.scaleX xscaler;

                                
_video.scaleY yscaler;

            

                        
_stream.play(videoPath imageArray[largeImageItem].largeImage0); 




i really don’t understand why it plays double???

Anyone had this problem before?

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0