4 Replies Latest reply on Sep 7, 2009 2:44 PM by Ned Murphy

    How do I get my slider to move when I click the groove

    Viking46 Level 1

      TheI have created a simple Adobe Flash movie which is to act as a slider control. The code that I have written is shown below. I am able to grab the slider and move it to any position on the groove but I wish to also be able to click anywhere on the groove so that the slider will jump and lock to that position.

      I have created a function:

      groove_1.onMouseDown = function(){
            trace('You clicked x = '  + this._x);

            slider_1._x = this._x;

      the problem is that the this._X coordinate returns the left-hand edge of groove_1 and not be positioned that was clicked on this control.

      Can someone tell me how to get this information out of the mouse down event?


      The code of the file is:


      slider_1.onPress = function(){
      this.startDrag(true, _root.groove_1._x, _root.groove_1._y, _root.groove_1._x + 520, _root.groove_1._y );
      .onRelease = function(){
      .onMouseMove = function(){
      = new Object();
      .x = this._x;
      .y = this._y;
      .onMouseDown = function(){
      ('You clicked x = '  + this._x);

      //slider_1._x = this._x;

      The source file is contained in the attached zip file