3 Replies Latest reply on Dec 24, 2006 3:23 PM by emilio_tha_don

    Help! loadMovie function..

    emilio_tha_don
      Hi everybody, I am currently working on project (website) and I want to know how to make an image or a swf file appear when I click on a button. I am having trouble incorporating the loadMovie function in my action script.

      here is my script for the buttons:

      b1.onRollOut = out;
      b1.onRollOver = over;

      b2.onRollOver = over;
      b2.onRollOut = out;

      b3.onRollOver = over;
      b3.onRollOut = out;

      b4.onRollOver = over;
      b4.onRollOut = out;

      b5.onRollOver = over;
      b5.onRollOut = out;

      function over() {
      this.gotoAndPlay(2);
      }

      function out() {
      this.gotoAndPlay(6);
      }

      If requested, I can send my fla file.
      Thx and happy holidays.
        • 1. Re: Help! loadMovie function..
          dr.Evol Level 1
          Hi!

          Well, I think the simplest solution is to use Loader component. Place your buttons on the first frame of the timeline then open Components panel and drag loader on the stage. Give it a instance name "loader" and then drop the following code to the first frame of your timline..

          var ref=this;
          b1.onPress=function() {
          ref.loader.contentPath="img1.jpg";
          }
          b2.onPress=function() {
          ref.loader.contentPath="img2.jpg";
          }
          b3.onPress=function() {
          ref.loader.contentPath="swf1.swf";
          }

          and so on...

          In the Loader component properties panel you can set up some more things like scaling the image to fit the loader size etc..

          If you dont want to use loader, you have to use MovieClipLoader class which is described in help. You need to create a empty movieclip and then tell the MovieclipLoader to load content into that movieclip using MovieClipLoader.loadClip method... some more code required to make it work but if you'll copy-paste the example from help it will work.
          The benefit of using MovieClipLoader is better controll over whats happening - you can handle loading progress, errors etc with events triggered by the class.




          • 2. Re: Help! loadMovie function..
            kglad Adobe Community Professional & MVP
            use an onPress handler to trigger your loadMove() statement. for example:

            • 3. Re: Help! loadMovie function..
              emilio_tha_don Level 1
              quote:

              [Give it a instance name "loader" and then drop the following code to the first frame of your timline..


              The code u gave me, on what layer should I put it ? On the same layer as where my button codes are located ?

              Because I tried putting your code and all I could see in the loader area is a white box...