2 Replies Latest reply on Nov 11, 2009 7:52 AM by benoismyname

    What's Wrong With This AS3?

    benoismyname

      Hi;

      I'm a noob to AS3 and I know this code couldn't possibly work because I don't call "Main". Please advise.

       

      import flash.display.MovieClip;
      import com.greensock.*;
      import com.greensock.plugins.*;
      import com.greensock.easing.*;
      TweenPlugin.activate([AutoAlphaPlugin]);
      public class Main extends MovieClip
      {
      private var mcHatAndFace:MovieClip;
      public function Main():void
      {
      mcHatAndFace = new LibraryItem();
      mcHatAndFace.x = 100;
      mcHatAndFace.y = 100;
      mcHatAndFace.alpha = 0;
      addChild(mcHatAndFace);
      }
      }
      TweenLite.to(mcHatAndFace, 1, {autoAlpha:1}); // 2nd param in seconds; 3rd in % alpha

       

      TIA,

      beno    

        • 1. Re: What's Wrong With This AS3?
          kglad Adobe Community Professional & MVP

          do you want to make Main your document class?  if so, click on the stage and in the properties panel you'll see a textfield where you can enter the document class.  type Main

          • 2. Re: What's Wrong With This AS3?
            benoismyname Level 1

            When I went to enter that and create a swf, it stated that the document class couldn't be found and would be created. Despite the fact that I canceled out of it, then closed the fla without saving, it *still* saved that change! At any rate, the swf didn't play. I thought perhaps I should add to the script, which is on the first frame of its own layer, a gotoAndPlay(Main). At any rate, nothing's working. Please advise.

            TIA,

            beno

             

            import flash.display.MovieClip;
            import com.greensock.*;
            import com.greensock.plugins.*;
            import com.greensock.easing.*;
            TweenPlugin.activate([AutoAlphaPlugin]);
            public class Main extends MovieClip
                {
                    private var mcHatAndFace:MovieClip;
                    public function Main():void
                    {
                        mcHatAndFace = new LibraryItem();
                        mcHatAndFace.x = 100;
                        mcHatAndFace.y = 100;
                        mcHatAndFace.alpha = 0;
                        addChild(mcHatAndFace);
                    }
                }
            TweenLite.to(mcHatAndFace, 1, {autoAlpha:1}); // 2nd param in seconds; 3rd in % alpha
            gotoAndPlay(Main);