A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: start/stopDrag() vs. MOUSE_MOVE?

Threaded View

  1. #6
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    I actually lean towards MOUSE_MOVE. It's easier to adjust the placement of the icon.

    Also, I'm not sure if this is a problem w/ AS3 (I haven't tried it), but I seem to recall there being a conflict if you try to use startDrag on two objects simultaniously. So if you want to let a user drag something, then you're in trouble because they're already dragging the cursor icon. You can move as many objects as you want with MOUSE_MOVE. Oh, and startDrag tends to make stuff "blink" to the cursor location on click, not that it matters with your current project.

    But uh, don't take my word for it. I haven't used startDrag since AS2.

    I would move the "myCursor_mc.visible = true;" line outside of the function though. There's no need to tell the clip to be visible every time the mouse moves; unless you have a timer that makes it disapear after sitting idle.

    as for cacheAsBitmap... you usually only want to do it if you have a highly detailed vector art that stays static. Otherwise, if the object is moving, you're making flash work extra hard to render the vector as a bitmap every frame. If you have the debug version of flash installed, you can right-click and have it "Show Redraw Regions" to see what flash is drawing each frame.

    There is another use for cacheAsBitmap though. If you want to use alpha channels in a mask, you can make both the object and its mask cacheAsBitmap. Very handy, but again, very processor intensive.

    Now I've gone and said too much.

    ------
    Edit:

    Oh, and Joshstrike's code is good. He's using ENTER_FRAME instead, which is probably going to be the quickest response. I guess the best method ultimately depends on your projects frame rate and how processor intensive it is.
    Last edited by Ralgoth; 05-06-2009 at 11:19 PM. Reason: Read Joshstrike's code
    Search first, asked questions later.

Tags for this Thread

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