A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: While MouseDown

  1. #1
    Member
    Join Date
    Oct 2001
    Posts
    48

    While MouseDown

    'Lo

    I'm kinda stuck with a little script I'm writing

    I've already got a function defined that duplicates an MC... with some extra code too, but I want the function to be run every time the frame refreshes whilst the mouse-button is held down

    I figured its got something to do with the Mouse.AddListener() method, but I can't figure it out

    Right now I'm using:

    PHP Code:
    Brush.onMouseDown = function(DupStroke) {
        
    n++;
        
    rokx _root._xmouse;
        
    roky _root._ymouse;
        
    duplicateMovieClip("Stroke""stroke"+nn);
        
    _root["stroke"+n]._x rokx;
        
    _root["stroke"+n]._y roky;
    }; 
    But this only works once... when the button is clicked

    I want to be to duplicated whilst the button is held down

    Any ideas? (this has gotta be an easy one)

    -W3bbo

    <!-- Added -->

    Hmm, it would appear another posting appears from me directly below this one from me, but with no content whatsoever... Probably a bug in the BB software... no, I was not double-posting for attention)
    Last edited by W3bDevil; 07-19-2004 at 10:16 AM.

  2. #2
    cake! Skribble_Style's Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    550
    well if u want it to keep duplicating while the mouse is held down try adding a timer and checking if the mouse is still down within a certain time and if it is then run the function again
    Skribble

    Its not that im lazy, I just dont care.

  3. #3
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    code:
    brush.onMouseDown = function(){
    _root.pushed = true;
    }
    brush.onMouseUp = function(){
    _root.pushed = false;
    }
    brush.onEnterFrame = function(){
    if(_root.pushed == true){
    //do stuff
    }else{
    //do other stuff
    }
    }




    Of course you will need to insert your code.

    _t
    I don't feel tardy.

  4. #4
    Member
    Join Date
    Oct 2001
    Posts
    48
    Hmm, but could you use the Mouse.AddListener method at all?

  5. #5
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    Yes
    I don't feel tardy.

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