dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: moviing a movieclip in specified pixel increments

  1. #1
    Hello,

    I would like to move a movieclip in specified increments. IE - when you click a button the specified movieclip will move 5 pixels down. So if the center value of the movieclip is 0 it will then be set to 5 once the button is clicked. If you were to click this same button with the same code again then the center value would move to 10, etc...

    The code I am using is as follows:

    on (press) {
    _root.services._y = _y + 5;
    }

    Is this the correct code to use for this action? I can't get it to work properly. Thanks in advance!

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    184
    Almost right, but you left something out. Try:

    on (press) {
    _root.services._y = _root.services._y + 5;
    }

    In your version, the _y after the = has no value, since it doesn't refer to an object.

    Here's another version of the above which is involves less typing:

    on (press) {
    _root.services._y +=5;
    }

    += means increase this value by the number following +=

    To decrease values you can use -=

    Helps?

  3. #3
    Great! It works! There is only one problem.

    I have a set of buttons that control the same movieclip using the slide animation technique. The above code works if I do not click one of those buttons. If I click one of those buttons, and the movieclip slides to a new center value the down arrow button that moves the movieclip 5 pixels does not work.

    Essentially, once I engage the buttons with the "slide" animation technique the down button will not function.

    Any ideas?

    Thanks!

  4. #4
    Essentially, I have a movieclip that is controled by scrolls arrows. There is also a set of buttons that will slide the movieclip to a designated area (very similar to HTML anchors).

    Is there a more effiecient way to accomplish this?

  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    184
    Is there a more effiecient way to accomplish this?

    If you post some code I'll have a look...

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