Groups | Blog | Home
all groups > flash actionscript > january 2004 >

flash actionscript : Button help


tina8621
1/27/2004 11:34:05 PM
I got the apples to do what I wanted, but instead of having them as buttons I made them into movie clips and did a drag script. Which works perfectly. BUT I want to make a button that will put all the apples back onto the tree.

Right now I'm trying to do

on release() {
gotoAndPlay(2);
}

But all it does is flash the button.

I incerted a keyframe at frame 2 (there is only 2 frames), took the script out for the drag and placed all the apples on the tree as they were when the game first opens....but still nothing.

If anyone has any suggestions they would be greatly appreciated.


tina

pwiop
1/28/2004 1:04:40 AM
Assuming you call your apple MCs mcApple1, mcApple2, mcApple3 etc you can use the following code to return the apples to their original positions

ap1x=mcApple1._x
ap1y=mcApple1._y

ap2x=mcApple2._x
ap2y=mcApple2._y

ap3x=mcApple3._x
ap3y=mcApple3._y

then your button even says

mcApple1._x=ap1x
mcApple1._y=ap1y

mcApple2._x=ap2x
mcApple2._y=ap2y

mcApple3._x=ap3x
mcApple3._y=ap3y

this will return the apples to the original position

paul

tina8621
1/29/2004 11:08:03 PM
I actually made one movie clip, named it appledrag and added 20 layers into the scene for each of the apples.

Should I go back and rename each one to mcapple1 and so on and put it all on one scene? Or should I just try the code the way you have it but with what I named it?



pwiop
1/30/2004 12:05:41 AM
what would probaby be a good idea is to make it all in one frame. Create an mc that is your tree and another mc for your apple. then copy numerous copies of the apple onto the tree an five them instance names such as apple1 apple2 etc

pwiop
1/30/2004 12:40:36 AM
I have attached an example for your perusal - I have used mx2004 though so let me know if you cannot access it

paul

http://webforums.macromedia.com/attachments/apples.zip

tina8621
2/3/2004 7:10:42 PM
The file wouldn't open...could you save it just as mx? thanks

pwiop
2/4/2004 12:05:57 AM
tina8621
2/10/2004 7:48:49 PM
I actually figured it out. Another of my teachers helped me, but I do appreciate the help...I'm sure I will use this in the future.

Thanks,
AddThis Social Bookmark Button