![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Mar 2007
Posts: 22
OS: XP
|
Using Flash8 - Action on Buttons
Hey guys
I am currently learning how to use Flash 8 (primarily how to make flash animations of course). I am just following a text book but for the most part I have made everything spot on. Anyway, I am having problems with creating buttons that actually work. I have made the button (new symbol, set as button, designed the top, face, etc...) and carried it from my library onto the stage. I now have my button selected and the action menu ready to go. The textbooks states: "In the Actions toolbox, click the Actions folder to display the various action categories available.Then click the Movie Control folder to display the list of actions that control a movie." "Double-click Play under Movie Control in the actions list to insert the Play action code into the script pane." At this point, when I select my button, the code on the right of the action screen will now show the command "play". however, when I test the button, it simply does not work. An Error message also comes up that says: Code:
**Error** Scene=Scene 1, layer=Buttons, frame=1:Line 1: Statement must appear within on handler
play();
Any ideas where I am going wrong? thanks! |
|
|
|
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 948
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Using Flash8 - Action on Buttons
Hey, i haven't used flash in a while, but i'll help as best i can...
Are you using "Script Assist" to write your script? If so then stop, close script assist and write it from scratch(you'll end up with more control over your animations etc)... Anyway your error is telling you that the play(); method needs to be called within an event handler: I believe what you're trying to do is this: on(press){ play(); } the main difference being that on(press) tells flash when to run the action(play) wheras before you just told it to run the action(play)... read into event handlers if you need to but that's what flash is going on about there... Try it out and if it doesn't work post back... Cheers, Jamey |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Mar 2007
Posts: 22
OS: XP
|
Re: Using Flash8 - Action on Buttons
Hey thanks for the reply. I am using the assist program within flash but only because I am a beginner and the course I am taking hasn't had me learning the "code" of it all. I'm sure in later courses I most certainly will.
I think part of the problem might be the commands that I am using to apply the "start" command is actually only applied to the timeline, not the button. I need to find the set that applies to the buttons. Getting closer, thanks for the help. ps; if you have additional input, please feel free, I am still learning! |
|
|
|
|
|
#4 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 948
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Using Flash8 - Action on Buttons
hey, sorry i'm finding it hard to visualise what's going on...
I understand you have a button yeah? and when it's clicked you want the movie to continue? If you want to do this from the timeline(so the actions are on a frame) then i can advise on that too: Code:
- click the button
- In the bottom left there will be an "Instance Name" field
> change it to something like "myButton_btn"
- Click on the frame you want the actions on
- type:
myButton_btn.onPress = function(){
_root.play();
}
Still, if you haven't got this sorted yet then feel free to upload the .fla file (you may have to zip it) and attach it to a post if you want a definitive answer... Hope you get it sorted, post back if you need more help Cheers, Jamey |
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Mar 2007
Posts: 22
OS: XP
|
Re: Using Flash8 - Action on Buttons
Hi,
I tried your advice, but much like when I read the textbook there seems to be a missing link. I've included a screen shot so you know what I am working with. You will see the basketball and a start and a stop button. When I play the movie now, the basketball bounces. I need the stop button to stop the bouncing, and the start button to make it start. I cannot say whether I need it to be controlled through the timeline or not because I just don't know. This is my first experiance with it. I do know that I am using the actions menu (hit F-9 in Flash 8 to bring it up). The class doesn't teach code so thats not the problem. Anyway, thanks for the help, I will keep trying. PS: my main problem is the textbook teaches the lessons with Flash MX and I use 8 so I know I am close. It seems as though the actions menu changed quite a bit. Thanks again. |
|
|
|
|
|
#6 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 948
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Using Flash8 - Action on Buttons
Hey ok i understand what's going on now, i see you have actions on your first frame, would you mind copying them here so i can help you out...
(Click on the first frame, open the actions menu and copy the lot) Anyway, the basic procedure would be to: - click the start button - press F9 - type Code:
on(press){
_root.play();
}
- click the stop button - open the actions panel again(F9) - type Code:
on(press){
_root.stop();
}
Cheers, Jamey |
|
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Mar 2007
Posts: 22
OS: XP
|
Re: Using Flash8 - Action on Buttons
Jamiemac,
thank you for your help so far, we might be getting close. I am attaching another screenshot that better explains my current dilemma. As you will see by the screen shot, I am unable to type in code. I can click on the timeline, but that selects both buttons. The only thing I can think to do is make a new layer for each button, but that just doesn't go with the textbook at all, and also seems like a great deal of work. Anyway, thanks again and I have made little notes in the screen shot to point out my problems. |
|
|
|
|
|
#8 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Northampton, UK
Posts: 948
OS: Win Vista Home Premium & Ubuntu Hardy(8.04)
|
Re: Using Flash8 - Action on Buttons
Okay, the message "Current selection cannot have actions applied to it..." means that you've selected too much (i think), note that you've selected all of the layer's frames in the layers panel(and you only need to select one) try clicking the first frame in the layer to select only that frame (if you cant then double click etc)... also try just clicking one of the buttons (and ensure the buttons aren't the same button(both in the same symbol) etc.)... But yeah, the first frame should be the only one highlited...
Cheers, Jamey |
|
|
|
![]() |
| Thread Tools | |
|
|