9 Replies Latest reply on Jul 2, 2006 4:18 PM by devilmuzik

    Loaded .swf loses functionality (Flash 8 Loader compnent)

    devilmuzik
      Hi all...long-time listener, first -time caller...

      I have a file with a Loader and ProgBar component. The Loader pulls in a swf with buttons. The buttons control Sound objects to play MP3 files. When the second swf loads, the MP3's dont play. The music is embedded, not loaded externally. If i call the direct URI of the swf, the dopey thing plays! But loaded through the Loader component...the swf loads, the buttons display their rollovers...but the sounds refuse to play...it fails in test movie too...

      I'm certain that this is just a fundamental flaw I've created (the missing curly bracket syndrome), but i havent got a clue what it is and any help would be greatly appreciated.
        • 1. Re: Loaded .swf loses funtionality
          Level 7
          Not sure if this is what you need to consider:
          http://livedocs.macromedia.com/flash/8/main/00002980.html

          --
          Lon Hosford
          www.lonhosford.com
          Flash, Actionscript and Flash Media Server examples:
          http://flashexamples.hosfordusa.com
          May many happy bits flow your way!
          "devilmuzik" <webforumsuser@macromedia.com> wrote in message
          news:e7v7a7$m9v$1@forums.macromedia.com...
          > Hi all...long-time listener, first -time caller...
          >
          > I have a file with a Loader and PrgBar component. The Loader pulls in a
          > swf
          > with buttons. The buttons control Sound objects to play MP3 files. When
          > the
          > second swf loads, the MP3's dont play. The music is embedded, not loaded
          > externally. If i call the direct URI of the swf, the dopey thing plays!
          > But
          > loaded through the Loader component...the swf loads, the buttons display
          > their
          > rollovers...but the sounds refuse to play...it fails in test movie too...
          >
          > I'm certain that this is just a fundamental flaw I've created (the missing
          > curly bracket syndrome), but i havent got a clue what it is and any help
          > would
          > be greatly appreciated.
          >


          • 2. Re: Loaded .swf loses funtionality
            devilmuzik Level 1
            Thanks Lon...
            I got really excited and set lockroot on the SWF I am loading...to no avail...
            If I copy the sound files from the musicplayer.fla Library into the musicloader.fla Library, it works. This seems to make it clear that it is a _root mixup, but I am mystified why "this._lockroot=true" on the main timeline doesnt work. Obviously there isnt much point in having a 3 Mb preloader for a 3 Mb movie...
            I'm still looking...
            • 3. Loaded .swf loses functionality (Flash 8 Loader compnent)
              Jan-Paul K.
              did you experience the same problems when using the MovieClipLoader in order to load you external movie into the main movie?

              I wouldn't be to surprised if the flash loader component doesn't do its job as intended on complex flash aplications. My experience is that it is faster and more flexibe to build your own preloders instead of using built in components.

              simply try the following to load your external mc:

              var mcl:MovieClipLoader = new MovieClipLoader();
              var listener:Object = new Object();
              listener.onLoadInit = function (){
              trace("done loading");
              }
              listener.onLoadProgress = function(target_mc, loadedBytes:Number, totalBytes:Number) {
              trace(loadedBytes+ " of "+loadedBytes+" bytes loaded");
              }
              mcl.loadClip("sound.swf",target_mc);
              • 4. Loaded .swf loses functionality (Flash 8 Loader compnent)
                devilmuzik Level 1
                Thanks Jan-Paul and Lon... your assistance is greatly appreciated...

                I feel tantalizingly close, but using MovieClipLoader class to do an overt load (instead of using the Loader component) results in the same behavior. Clip loads, sound objects fail...
                I always proceed from the assumption that whatever is wrong is my doing (and I am still assuming that), but this is getting irksome...
                I've tried using "this.myLoader.content._lockroot = true" on the main timeline of the loader SWF, and it failed as well. It seems clear that the only problem is that the loader doesnt see the Library for the loaded clip (the MP3's), but I am not even referencing _root anywhere in the loaded clip! This clip is seven buttons that trigger sounds, not complex by any means...this stuff is making me long to go back to working in scenes (said ironically).
                The buttons use attachSound()...so i kinda get whats happening...but if the Loader can't see the loaded clip's lib, why the heck are the buttons showing up?

                Any and all help (including just telling me I'm a big dope and should give this up) is appreciated...
                • 5. Re: Loaded .swf loses functionality (Flash 8 Loader compnent)
                  Jan-Paul K. Level 1
                  could you post the complete AS source used on the button?
                  • 6. Re: Loaded .swf loses functionality (Flash 8 Loader compnent)
                    devilmuzik Level 1
                    Hi Jan-Paul...here it is...
                    _______begin code_______
                    on (press) {
                    stopAllSounds();
                    mySound = new Sound();
                    mySound.attachSound("pl");
                    mySound.setVolume(100);
                    mySound.start();
                    }
                    _______end code_______
                    I've tried declaring the sound var everywhere...the loader clip's main timeline...I even tried declaring it as a _global...still no joy...
                    It is clear that this is something to do with how I'm handling the Sound object, but still don't get why myLoader.content._lockroot=true didnt work...
                    Remember...the player works when called by itself...it just fails to play in the loader...
                    Your continues help is much appreciated...
                    • 7. Re: Loaded .swf loses functionality (Flash 8 Loader compnent)
                      Level 7
                      I think the problem is the use of attachSound in an externally loaded movie.

                      attachSound (Sound.attachSound method)
                      public attachSound(id:String) : Void

                      Attaches the sound specified in the id parameter to the specified Sound
                      object. The sound must be in the library of the current SWF file and
                      specified for export in the Linkage Properties dialog box. You must call
                      Sound.start() to start playing the sound.

                      To make sure that the sound can be controlled from any scene in the SWF
                      file, place the sound on the main Timeline of the SWF file.


                      --
                      Lon Hosford
                      www.lonhosford.com
                      Flash, Actionscript and Flash Media Server examples:
                      http://flashexamples.hosfordusa.com
                      May many happy bits flow your way!
                      "devilmuzik" <stephen@ncgraphics.com> wrote in message
                      news:e83i28$7s4$1@forums.macromedia.com...
                      > Hi Jan-Paul...here it is...
                      > _______begin code_______
                      > on (press) {
                      > stopAllSounds();
                      > mySound = new Sound();
                      > mySound.attachSound("pl");
                      > mySound.setVolume(100);
                      > mySound.start();
                      > }
                      > _______end code_______
                      > I've tried declaring the sound var everywhere...the loader clip's main
                      > timeline...I even tried declaring it as a _global...still no joy...
                      > It is clear that this is something to do with how I'm handling the Sound
                      > object, but still don't get why myLoader.content._lockroot=true didnt
                      > work...
                      > Remember...the player works when called by itself...it just fails to play
                      > in
                      > the loader...
                      > Your continues help is much appreciated...
                      >
                      >


                      • 8. Re: Loaded .swf loses functionality (Flash 8 Loader compnent)
                        devilmuzik Level 1
                        Thanks Lon...sorry I havent gotten back but yesterday was my birthday and i was hanging with family all day...
                        Im such a bone head...here it is (referring to above posted code...)

                        Instead of mySound =new Sound();

                        mySound = new Sound(_root);

                        Thanks to both of you guys for your help....obviously this would've fixed the MovieClipLoader thingie too

                        Peace

                        Stephen McDaniel
                        New Century Graphics

                        • 9. Loaded .swf loses functionality (Flash 8 Loader compnent)
                          devilmuzik Level 1
                          PS: I got this solution mainly from LiveDocs all props and respect to the others out there who's insights I pored over while I way overthought a very simple problem...yeeessshhh

                          your kung-fu is best

                          Stephen