A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: attach to mouse while in coordinates

  1. #1
    Flashkit Witch Azaraelle's Avatar
    Join Date
    Nov 2000
    Location
    South Africa
    Posts
    123
    I have created a scratch card and now want to attach a coin to the mouse if the mouse is within certain coordinates and have the coin un-attach itself once the mouse leaves the specified coordinates. How do i do this?

    I used startDrag ("coin", true, 56.0, 118.0, 272.0, 330.0); but then the user can't click on anything outside of this block.

    Please help!

  2. #2
    curmudgeon swampy's Avatar
    Join Date
    Jan 2001
    Location
    [wakey]
    Posts
    2,775
    have an mc represent the area within which the coin is to attach to the mosue and add this code to it's instance:
    Code:
    onClipEvent (enterFrame) {
    	if (this.hitTest (_root._xmouse, _root._ymouse))
    	{
    		_parent.coin._x = _root._xmouse;
    		_parent.coin._y = _root._ymouse;
    	}
    	else
    	{
    		_parent.coin._x = 0;
    		_parent.coin._y = 0;
    	}
    }

  3. #3
    Flashkit Witch Azaraelle's Avatar
    Join Date
    Nov 2000
    Location
    South Africa
    Posts
    123
    it tells me there are errors in the code?

  4. #4
    curmudgeon swampy's Avatar
    Join Date
    Jan 2001
    Location
    [wakey]
    Posts
    2,775
    it is lying, there are no errors in my code. There may be errors in where you are using my code though.

  5. #5
    Flashkit Witch Azaraelle's Avatar
    Join Date
    Nov 2000
    Location
    South Africa
    Posts
    123
    aahhh... please give me more detailed instructions. My brain is starting to fry! Perhaps if I could send you the file so you can see where my code is etc etc?

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