6 Replies Latest reply on Mar 23, 2007 2:24 PM by kglad

    Use Alpha on LoadMovie

    izm067
      Is it possible to use action script code with LoadMovie so it goes from an alpha of zero to alpha of 100 and just fades in? Or does each piece of the swf being loaded have to have the fade in built into it.

      I would like for the swf to fade in when it is loaded the first time, but if a button is clicked to return to the swf, I don't want it to fade in.

        • 1. Re: Use Alpha on LoadMovie
          kglad Adobe Community Professional & MVP
          you can fade everything in your swf by fading the parent timeline (_level0).
          • 2. Re: Use Alpha on LoadMovie
            emiliesue
            Hi kglad...

            I'm trying to do something like izm067...

            I have a clip where I load a .swf like this...

            loadMovie("monclip.swf", "p1b");

            where p1b is the contener for the swf... of course.

            So... later on the limeline (between the load and the unload) I want to decrease the alpha property like this:

            p1b.onEnterFrame = function() {
            this._alpha--;
            };

            Dont't work

            So I had tried this code ...

            _level0.onEnterFrame = function() {
            this._alpha--;
            };

            but this time... all the projet is affected ... cause my clip is in another clip who is in another clip...

            Can I control my swf by another way ?

            Thank you for you understand I'm a newbie and your explanations will be very appreciated.

            Sorry for my english...

            Émilie du Québec
            • 3. Re: Use Alpha on LoadMovie
              fasilak@gmail.com
              import mx.transitions.Tween;

              var container:MovieClip = createEmptyMovieClip("loader_mc", getNextHighestDepth());
              var mcLoader:MovieClipLoader = new MovieClipLoader();
              mcLoader.addListener(this);
              mcLoader.loadClip("1.swf", container);

              function onLoadInit(mc:MovieClip) {
              var alphaTween:Tween = new Tween(_root.loader_mc, "_alpha", null , 0, 100, 2, true);
              }

              The above code loads an swf 1.swf into an empty movieCLip.
              Once the swf has been loaded into the MovieClip loader object will call onLoadInit

              In onLoadInit you can write any code to animate the movieCLip.
              If you are using flash 8 the above code will work to provide an animation of alpha from 0 to 100

              Hope this helps
              • 4. Re: Use Alpha on LoadMovie
                kglad Adobe Community Professional & MVP
                p1b.onEnterFrame = function() {
                this._alpha--;
                };

                will work if it's placed on the timeline that contains p1b. you should probably use:

                • 5. Re: Use Alpha on LoadMovie
                  emilie1955
                  Thanks a lot... its work...

                  Should I use ...... unloadMovie("p1b");
                  Or... delete this.onEnterFrame;

                  Thanks again for your help

                  Émilie
                  • 6. Re: Use Alpha on LoadMovie
                    kglad Adobe Community Professional & MVP
                    use p1b.removeMovieClip() if you no longer need p1b for anything. if you'll need p1b later in your project, just delete that onEnteFrame.