6 Replies Latest reply on May 19, 2006 9:07 AM by Kevin0612

    loadmovie problem

    Kevin0612
      I have a flash web site and I'm trying to load a flash publicity in this flash web site.

      I'm using
      pub.loadmovie(pub1.swf);

      where pub is the occurance where I want to position it.

      My problem is that at the end of this animation I need to load another one at the exact same position wich I can't do.
      All I'm able to do is load something at the top left corner.

      I put the fallowing code to get it load at the top left corner
      loadMovieNum("pub2.swf", 1);


      What do I have to put at th end of my publicity to make it load on the pub occurance ?
        • 1. loadmovie problem
          blemmo Level 1
          A simple way is to replace "this" at the end of pub1.swf:
          this.loadMovie("pub2.swf");

          The loaded movie takes the instance properties of the MC it's loaded into, so when you load pub1.swf into the 'pub' instance, the 'this' keyword inside pub1.swf will point to the 'pub' instance, just as if you said
          pub.loadMovie("pub2.swf");
          in the main timeline.

          You could also just place a stop() in the last frame of pub1.swf, and watch the loaded MC from the main timeline:
          _root.onEnterFrame = function(){
          if (pub._currentframe == pub._totalframes){
          pub.loadMovie("pub2.swf");
          delete this.onEnterFrame;
          }
          }

          cheers,
          blemmo
          • 2. loadmovie problem
            Kevin0612 Level 1
            THanks a lot !!!

            That small little this made it all
            • 3. Re: loadmovie problem
              Kevin0612 Level 1
              Humm I have a little problem a bit different now.
              I will have more then 2 pubblicity. and I want them random...
              What I'm doign is this for the first one :

              loadVars = new loadVars();
              loadVars.load("pub.php");
              loadVars.onLoad = function(success) {
              if (success) {
              pub.loadMovie(this.var1);
              } else
              {
              pub.loadMovie("pub1.swf");
              }
              }

              This is all working find
              Now at the end of each pub I put the fallowing but it not working at all the first pub that load just loop..

              loadVars = new loadVars();
              loadVars.load("pub.php");
              loadVars.onLoad = function(success) {
              if (success) {
              this.loadMovie(this.var1);
              }
              }
              • 4. Re: loadmovie problem
                blemmo Level 1
                When you use 'this', be careful what it refers to in the context it's used. In the onLoad() event of a LoadVars objects it refers to that object (as in every event), so you can't use 'this.loadMovie(...)' there. Try 'this._parent.loadMovie(...)' or '_root.pub.loadMovie(..)' instead.
                • 5. loadmovie problem
                  Kevin0612 Level 1
                  I change what you said and it still not loading anything, it just continue and loop the pub that was first loaded.

                  It as if I didn't put any code at the end of each pub
                  • 6. Re: loadmovie problem
                    Kevin0612 Level 1
                    What else can I try ??