A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: swing movieClip (actionscript problem)

  1. #1
    Junior Member
    Join Date
    Sep 2000
    Posts
    25
    hi,

    here is the problem, i have a movieClip ,name "inter", when i release
    the mouse button
    i want the movieClip to go to the left ,by 5 unit, until it center point

    ("255.9") reach "-240.9".

    this is my script (on the button):

    on (release) {
    b = getProperty ("inter",_x);
    do {
    setProperty ("inter", _x, b - 5);
    } while (b > -240.9);
    }

    It does'nt work, why..????
    Is there another way to do this, or is there a swing command like in
    lingo ????

    thanks, mathieu


  2. #2
    Senior Member
    Join Date
    Sep 2000
    Posts
    108
    I'm no actionscript guru, just starting to learn, but I guess stuff work the same here as in any other programming language.

    Think the reason why it doesn't work the way you want it to is because the value of 'b' will be the same on every pass through the loop, or?

    Try something like:

    on (release) {
    do {
    b = getProperty ("inter",_x);
    setProperty ("inter", _x, b - 5);
    } while (b > -240.9);
    }

    Or maybe it would be better not to do the getProperty on every pass through the loop, I dunno how fast it is... Maybe this would be better:

    on (release) {
    b = getProperty ("inter",_x);
    do {
    b = b - 5;
    setProperty ("inter", _x, b);
    } while (b > -240.9);
    }

    Well, as I said, I'm no actionscript guru, but hope this might help! :-)


    @ndre

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Posts
    25

    swing movieClip (actionscript problem)

    thanks for the answer!

    but it does'nt work, the problems is, it not refresh
    between the pass, so it seems like it jump to the end
    of the loop.

    If you have to face this problem later, you have to
    make the script on 2 frames, first frame set the variable and the property (b - 5,in my problem), and the second have the IF command with go to the first frame if the IF is true and the ELSE stop.

    thank, for the help


    Originally posted by Elvan
    I'm no actionscript guru, just starting to learn, but I guess stuff work the same here as in any other programming language.

    Think the reason why it doesn't work the way you want it to is because the value of 'b' will be the same on every pass through the loop, or?

    Try something like:

    on (release) {
    do {
    b = getProperty ("inter",_x);
    setProperty ("inter", _x, b - 5);
    } while (b > -240.9);
    }

    Or maybe it would be better not to do the getProperty on every pass through the loop, I dunno how fast it is... Maybe this would be better:

    on (release) {
    b = getProperty ("inter",_x);
    do {
    b = b - 5;
    setProperty ("inter", _x, b);
    } while (b > -240.9);
    }

    Well, as I said, I'm no actionscript guru, but hope this might help! :-)


    @ndre

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