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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
Thread Tools
Old 06-04-2008, 01:18 PM   #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();
Total ActionScript Errors: 1 Reported Errors: 1

Any ideas where I am going wrong?

thanks!
zellerscrossing is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-04-2008, 07:50 PM   #2 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-05-2008, 05:14 PM   #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!
zellerscrossing is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-06-2008, 12:06 AM   #4 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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();
}
And that would do it, generally when writing flash stuff the majority of users will use an actions layer and use the frames within that to write any actions...

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
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-10-2008, 08:00 PM   #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.
Attached Images
File Type: jpg buttonhelp.jpg (43.1 KB, 2 views)
zellerscrossing is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-11-2008, 03:34 AM   #6 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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();
}
-close the actions panel
- click the stop button
- open the actions panel again(F9)
- type
Code:
on(press){
_root.stop();
}
That should do it, if you're still stuck then post back with the actions etc...

Cheers,
Jamey
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-11-2008, 03:50 PM   #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.
Attached Images
File Type: jpg buttonhelp.JPG (134.5 KB, 2 views)
zellerscrossing is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 06-12-2008, 01:53 AM   #8 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 12:21 PM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82