|
-
Flashkit Witch
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!
-
ism
try this;
1. make sure the coin is in an MC;
2. place the MC on the main stage.
3. right-click on the MC and select actions
4. enter;
Code:
onClipEvent(load) {
leftMargin = 100;
rightMargin= 300;
topMargin = 100;
bottomMargin = 400;
}
onClipEvent(enterFrame) {
if (_parent._xmouse > leftMargin &&
_parent._xmouse < rightMargin &&
_parent._ymouse > topMargin &&
_parent._ymouse < bottomMargin ) {
_x = _parent._xmouse;
_y = _parent._ymouse;
}
}
change the margin values to suite your needs
hope this helps
BlinkOk
-
Flashkit Witch
The coin is in a movie clip called coin but the script is giving me this error...
Scene=Scene 1, Layer=Layer 10, Frame=1: Line 1: Clip events are permitted only for movie clip instances
onClipEvent(load) {
Scene=Scene 1, Layer=Layer 10, Frame=1: Line 7: Clip events are permitted only for movie clip instances
onClipEvent(enterFrame) {
Generator is not enabled for this movie. C:\Projects\flash\scratch card\scratch2.swf
also, I expect I will have to specify a startDrag on the movie clip, where does this go in the code and what is the syntax?
-
ism
3. right-click on the MC and select actions
you need to right-click (not left-click) on the movie on the stage. one of the options from the pop-up menu will be Actions. Select Actions and paste the code there not in a frame. you don't need to use startDrag() the movie's _x/_y will change every time ther is a new frame.
hope this helps
-
Flashkit Witch
-
ism
i think ed_mack and phreax are the real heros but i'll take what i can get. now don't go mad with all that scratching, you'll get a rash!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|