1 Reply Latest reply: Dec 6, 2012 6:41 PM by Ned Murphy RSS

    How to define image scroller width parameters

    nikolaig Community Member

      I followed a tutorial on how to build an image thumb scroller. In this tutorial the image scroller  spans from one edge of the stage to another, i.e. flash to the edge. I would like to make it shorter in width, as 50 pixels off either edge of the stage. How do I define those parameters? What would be a line of code to cut it off where i want to? Here is what I have for building the scroller:

       

      /////Build Scroller MovieClip to Contain Each Image
      var scroller:MovieClip = new MovieClip();
      var padding:Number = 10;//creating a var for padding to be used later on in easier calculations
      
      this.addChild(scroller);
      scroller.y = 600;
      scroller.x = padding;
      

       

      (I tried scroller.x - but it only positions the scroller differently on the stage. Once it scrolls on mouse over it still jumps all the way to the left, and in any case it does not take care of the right edge)

        • 1. Re: How to define image scroller width parameters
          Ned Murphy CommunityMVP

          Chances are you only need to add a mask for the scroller object.  Create a rectangle that is as wide as you wish the thumbs to be on the stage and then turn it into a movieclip/sprite and assign it an instance name.  Then just assign it as a mask to the scroller using: scroller.mask = masksInstanceName;

           

          You may need to adjust the scroller code to use the mask boundaries instead of the stage if it currently specifies boundaries for the scroller.