dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Flipping movieclip through actionscript...

  1. #1
    Junior Member
    Join Date
    Apr 2001
    Posts
    13

    Post

    I want to flip a movie clip instance (a graphic) horizontally and vertically through actionscript when the user clicks on two seperate buttons. I know I can create another frame(s) in the movie clip for the other states (horizontal and vertical) that the buttons could jump the movie clip to on release, but I thought maybe there was another way...I am going to have a lot of graphics that I want to control so I am looking for the easiest solution. It seems like this should be a property that could be controlled through actionscript, but I don't see anything anything listed. Any help would be appreciated. Thanks.

  2. #2
    (sic) Covenent's Avatar
    Join Date
    Dec 2000
    Location
    Ireland
    Posts
    709
    You need to change the objects scale, either horizontally (_xscale) or vertically (_yscale).

    Here are examples:

    // These lines are comments, they dont affect anything

    // Flip 'myclip' horizontally
    mybutton.onPress = function () {
    myclip._xscale = -100;
    }

    // Flip 'myclip' vertically
    mybutton.onPress = function () {
    myclip._yscale = -100;
    }

    // Flip 'myclip' both horizontally and vertically
    mybutton.onPress = function () {
    myclip._xscale = -100;
    myclip._yscale = -100;
    }

    // Flip 'myclip' horizontally to the opposite way it is
    mybutton.onPress = function () {
    if (myclip._xscale == 100) {
    myclip._xscale = -100;
    } else if (myclip._xscale == -100) {
    myclip._xscale = 100;
    }
    }

    That should get you started, the only real things to note are that in the examples given above, both the button and movie clip are in the same timeline.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center