3 Replies Latest reply on May 5, 2010 4:14 PM by kglad

    What happens with sound? in Flash CS4 AS3

    Me2LoveIt2

      Hi,

      I have a couple of questions on the same topic:

       

       

      I was wondering what exactly is happening when I have this code:

       

      var sound:Sound = new Sound(new URLRequest("URL.mp3");

       

      does the mp3 file get downloaded?

           -If yes

                -where does it get downloaded to? Heap? Cache? or what do you call it

                -is there a way to stop or control the loading?

                -and can it be accesed(deleted) manually? is there a destructor?

                     -if possible

                          -How would you delete the memory?

                     -if not

                          -is there a way to do it with different code?

       

       

       

           -if not

               - at what point does it get downloaded? assuming the code continues like this:

                 var soundChannel:SoundChannel;

                 soundChannel = sound.play();

       

       

      I know there are many question, but they all depend on each other and i couldn't think of a easier way to ask.

       

      Thank you for any answers and tips!

        • 1. Re: What happens with sound? in Flash CS4 AS3
          kglad Adobe Community Professional & MVP

           

          var sound:Sound = new Sound(new URLRequest("URL.mp3");

           

          does the mp3 file get downloaded? yes

               -If yes

                    -where does it get downloaded to? Cache

                    -is there a way to stop or control the loading? no

                    -and can it be accesed(deleted) manually? ,yes.  is there a destructor? for the file, no

                         -if possible

                              -How would you delete the memory? same way you do for all flash objects:  ready sound for gc

                         -if not

                              -is there a way to do it with different code?

           

           

           


          1 person found this helpful
          • 2. Re: What happens with sound? in Flash CS4 AS3
            Me2LoveIt2 Level 1

            Thank you so much this really helps!

             

            here is the second part of my questions:

             

            Since there is no destructor, is it correct when I assume that after this code: ...

             

            var sound:Sound = new Sound(new URLRequest("URL.mp3");

            sound = new Sound(new URLRequest("URL2.mp3");

             

            ... both mp3 files will be downloaded into Cache, but only one is accessible at that time?

             

                 -if yes

                      -could you please give an example of how I can delete the first mp3 file in this example.

             

                 -if not

                      -How would this scenatio work then?

             

            again my thanks for the help.

            • 3. Re: What happens with sound? in Flash CS4 AS3
              kglad Adobe Community Professional & MVP

              you can't delete any files using a web based swf and you can't prevent cach'ing of media files unless you use a streaming server.

               

              in addition, each sound instance can load, at most, one sound.  so, where you use:

               

              var sound:Sound = new Sound(new URLRequest("URL.mp3");

              sound =  new Sound(new URLRequest("URL2.mp3");

               

              you're downloading 2 files and you've created 2 sound instances.  one of those instances you have no way to reference.

               

              now, what are you trying to accomplish?