2 Replies Latest reply on Oct 2, 2006 6:01 AM by ggshow

    Using actionscript to change properties of an object

      Hey, i've written this out once already but the post fecked up.

      What im wanting to do is create a flash document that allows me to alter the properties of a shape, at the touch of a few buttons. So im wanting to change the alpha colour, the xscale and the ability to rotate the shape.

      So what i have at the moment is three layers on my flash timeline - "buttons", "background" and "shape". All pretty self explanitory. For each of the buttons im wanting to be able to change the properties with a plus or minus button. The script that im thinking will work is this..

      xScale - button._xscale
      Rotate - button._rotation
      Alpha - button._alpha

      However im not sure how to link the buttons to the shape itself to make the properties of that shape to move. The shape (for the mean time anyway) is just the polystar tool within flash itself. Will i have to have the shape within a text box or something like that so the box rotates with the shape within it. As i dont use actionscript that often (i know simple basics that about it) so im not sure what the event handler on them will be. Here's a screenshot of the work area that i have just to clear it up a little.


        • 1. Re: Using actionscript to change properties of an object
          Glazer Level 1
          1. If you're lazy, just download the file below:

          Otherwise follow steps 2-4:

          2. Make sure your buttons have instance names (in the "Properties" panel at the bottom)
          You could name them using easily identifiable names like below, or use your own naming convention:

          3. Convert your "Shape" into a MovieClip and give it a name, in this case "ShapePent" (very important, otherwise nothing will work)

          4. Then you need to add some code to the actions layer:

          • 2. Re: Using actionscript to change properties of an object
            ggshow Level 2
            convert the shape to movieclip symbol, and set the instance name for it.

            let say we set the movie clip instance name to : shape

            then you can use buttons to control properties of "shape", e.g.