dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Mouseaction onLefMousebuttonHoldDown

  1. #1
    on(press) if I click down my mouse button
    on(release) if I release the mouse button

    But how can I do an action for the time I
    hold the left mouse key down ?

    Press Mouse and scroll until mouse release ??

    Regards
    Boris

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    318
    on (press) {
    //will call this untill mouse is no longer being pressed.
    doSomething ();
    }

    on (release) {
    //will be called when mouse is released.
    stopDoingSomething ();
    }

    you were right, the press is when you "press" the mouse button, so in theory when you "hold it down" you are pressing it many times... think of it that way

  3. #3

    Hmm

    Nope

    I will scoll an image from left to right.
    on(press) will move it x pixels to the right an stop.

    if i write
    while(on(release)) {

    the scrpit hangs up with a failure !

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Posts
    318
    i usally do this:

    make a movie clip with two frames, and

    frame 1:
    play();

    frame 2:
    //do error checking...
    if( ../scrollMov/:_x > 0 && ../scrollMov/:_x < 350 ) {
    ../scrollMov/:_x = ../scrollMov/:_x + ../:scrollDir
    }
    //thats how its done... and its not correctly formatted for flash 5, but it shows ya how its done in flash 4 and also in flash 5...

    here;s flash 5 version:
    frame 1:
    play();

    frame 2:
    if(_parent.scrollMov._x > 0 && _parent.scrollMov._x < 350) {
    _parent.scrollMov._x += _parent.scrollDir;
    }
    gotoAndPlay(1);

    basically, you just do:

    on (press) {
    scrollPos = 3;
    }
    on (release) {
    scrollPos = 0;
    }

    and for the down position, you do:

    on (press) {
    scrollPos = -3;
    }
    on (release) {
    scrollPos = 0;
    }

    piece of cake eh??

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