3 Replies Latest reply on Apr 5, 2007 9:30 AM by eric76

    MovieClip Scroller

    martincou Level 3

      I'm trying to do something really basic, but, I think I am complicated the thing. I'm trying to do a slidebar that when you drag it, a MovieClip begins to move. When your are the start of the scroll bar, the movie clip is at the start and when your at the end of it, the movie clip is at his maximum (._x). You can see what I did yesterday here and at the same time, you will see the problem I have with it. Can someone help me? I try to do it as simple as possible. You can download my .FLA by clicking here. And I would like to know what I did wrong (even if it's everything...)

      Thanks for your help!
        • 1. Re: MovieClip Scroller
          eric76 Level 1
          Yes I think u are complicating things. However I have a hard time seeing exactly where and why, because I dunno french (it is french isnt it?), so it's hard for me to understand the code. However, add this simple code to your glissere actionscript:
          onEnterFrame = function() {
          _root.grosClipCarresRouges._x = (100 - poignee._x) * 2.2;
          It should get u going...
          The constants 100 and 2.2 I got from trial and error. In general it's better to not to hard code such values but take the different dimensions as arguments to a function which then calculates them.
          • 2. Re: MovieClip Scroller
            martincou Level 3
            I finally succeed to do what I was trying to do! You can see it at this URL: http://www.martinc.biz/solveissue/

            What I was trying to do is to this without that code:

            onClipEvent (enterFrame) {
            this._x = _root.glissiere.poignee._x * 2.5;

            Because, in many books I read, some Flash developers says that it's not a good way to put Actions directly on instances (and it's very amateurish). Can someone tell me how to do the same thing WITHOUT put any code on instance?

            Thanks a lot for your help !
            • 3. Re: MovieClip Scroller
              eric76 Level 1
              Writing code directly on instances is error prone. What u do is write a function for the movieclip that contains the boxes, e.g. moveBoxes(x), and then u can have an onEnterFrame in _root, that propagates any scroll movements to the boxes, like:
              (Variablenames in english)