dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Another rotation problem

Hybrid View

  1. #1
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96

    Another rotation problem

    Hi All,

    Ok I have question here before and it must have bamboozled everyone as no one had even an idea of how to go about this, so I will try am simplify it:

    I have one MC of a circle that spins clockwise or counterclockwise depending upon the mous position, this is achieved using a startDrag function.

    What I am trying to do is have a series of buttons that when pressed will stop the drap function and rotate the circle to a given point, for instance 90 degrees, 180 degrees, 270 degrees and 360 degrees. When the mouse is moved off the button th circle resumes its startDrag rotations.

    The code attached to a 'dragcontroller' MC is

    xPos = getProperty("_root.nav1.dragControl", _x);
    xPos = xPos +(10);
    setProperty("_root.nav1.nav", _rotation, getProperty("_root.nav1.nav", _rotation)+(xPos/25));

    In addition the following code is attached to the first frame of the movie:
    startDrag(_root.nav1.dragControl, true);
    stop();
    fscommand("allowscale", "false");

    I have attached asimplified FLA for any that think they can crack this one.

    I am having a nightmare so could someone at least give me some suggestions.

    Thanks to all who answer in advance

    Richie
    Attached Files Attached Files

  2. #2
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    I have no idea why you drag the empty movieClip like that

    Anyways here is your fla with shiney new code, enjoy
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  3. #3
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96

    Thanks very much Lexicon

    Thanks for your help, but I am using the first generation MX package and can not open the file that you attached, would it be possible to send it again?

    As for why I want it to do this, I promise to show you once I am done, hopefully a couple of weeks.

    Many thanks

    Richie

  4. #4
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96

    Why d I drag it like that?

    Been thinking about that and I am wondering if you are seeing the correct effect.

    Basically the circle is in the middle of the screen and rotates clockwise or anti-clockwise dependant upon where the mouse is on the screen. There is also an acceleration deceleration thing built in again dependant upon mouse proximity.

    Does that explain it better...

    Cheers for now

    Richie

  5. #5
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    sure thing, I always forget to convert the files I post, here you go....
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  6. #6
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96

    Thanks for that

    Thanks for the fla, I am now trying to apply the same to another dial which rotates the opposite way, nay ideas?

    I now that to change the direction you just change the += bit to -= but this applies the change to both circles...

    Not after the code just some ideas to point me i the right direction.. if you don't mind

    Many thanks

    Richie

  7. #7
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96

    Don't worry just sussed it

    Thanks for all your help lex, just sussed the answer to my last question.

    Many many thanks for your help

    Richie

  8. #8
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    No worries.

    Glad you managed to work it out for yourself too, it means you learned something

    Enjoy
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

  9. #9
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96

    Just one question ...

    Thanks for everything so far, just one question...if you don't mind.

    I have squashed on of the circles to make it look like it is 3d to do this and have it still rotate i had to put it within another MC and it works...except the central registration point for the circle moving CW and ACW is no longer the centre, but the left edge of the stage..

    Is there any reason for this and is there something I can do about this.

    I have attached the fla again so you can see what i mean.

    Cheers for your help Lex

    Richie
    Attached Files Attached Files

  10. #10
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    change defaultRotate3 like this.....

    code:

    function defaultRotate3() {
    this._rotation-=Math.round((this._parent._xmouse-this._x)/defaultSpeed);
    }

    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

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