-
dragging a symbol (flash 8)
I've created a movie in which a graphic symbol appears when I press a button, and I was wondering what the code would be that would allow someone to drag the graphic around the screen and place it in a certain spot.
-
Code:
myMovieClip.onPress = function(){
startDrag(this);
}
myMovieClip.onRelease = function(){
stopDrag();
}
-
I tried using this code but I couldn't get it to work, are there any specifics I need to be aware of? Like where to put it in relation to the image that I want to move around the screen, etc.
-
it needs to be on the timeline where the image movieclip is. You will need to have instance name on the movieclip and use that instance name in place of the myMovieClip in the code above
-
I still can't get it to work, and I'm receiving this error message:
**Error** Symbol=incense, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
incense.onPress = function(){
**Error** Symbol=incense, layer=Layer 1, frame=1:Line 5: Statement must appear within on/onClipEvent handler
incense.onRelease = function(){
Total ActionScript Errors: 2 Reported Errors: 2
-
can you post your fla so i can look at it? You are probably putting it in the wrong place.
the code needs to be on the main timeline not attached to the item itself
Last edited by VI Knight; 10-11-2006 at 01:30 PM.
-
I tried to upload the fla file but it was way too big. Then I figured out how to get it to work anyway:
mc.onMouseDown = function()
{ this.startDrag(); }
_root.onMouseUp = function()
{
stopDrag();
}
was the code I needed to put on the symbol, but thank you for your help as well.
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
|