A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Slide function problems

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    8

    Slide function problems PLEASE READ updated

    Hi,

    I've written a script contained within an MC that that slides that MC to the target on the 1st onRelease and back to it's original position on the 2nd onRelease (so it returns from the target to it's original location).

    It worked for just the original MC, but when I duplicated the MC most of the additional MCs would only work the first time but then stop. Some work as they should as does the original still, but most will go to the target and back to their original location and then stop working.

    You can check it here

    I'm not sure whether the conditions within the IF statements are being met, whether the way I've expressed the conditions is a wrong, or whether the scope of my variables is wrong - I'm just not all that great at AS!

    Any help would be greatfully received!

    Thanks for looking.

    *EDIT*

    I have figured out that the problem only occurs if the MC _x or _y is greater than the targets _x or _y: so I think it may be an issue with the way I have calculated the difference between the MC and the target! Currently xDifference = targetX - _x;

    Is there a way of turning a negative number into a positive one?

    If you look here you will see what I mean.

    TIA

    *EDIT2

    I tried Math.abs but this isn't the problem (atleast I'm pretty sure it's not and I'm now not sure why I thought it might be).

    It seems to be directly related to the location of the MC and if either the _x or _y is greater than the targets _x or _y!

    PLEASE HELP! Shots in the dark gratefully received!!
    Last edited by DNOTICE; 05-31-2006 at 10:11 AM.

  2. #2
    Junior Member
    Join Date
    May 2006
    Posts
    8
    OK so I hugely over-complicated things! The original script was getting stuck in the second if statement.

    I have re-written the script using an if else and it now almost functions how I want it to BUT there is still one quadrant that will work only once before failing.

    If someone could have a look and suggest why this might be I would be hugely grateful - I'm sure it's just another newbie mistake with a simple solution!
    CHECK HERE

    TIA.

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