I have the book for flash 8, but I purchased CS3 (so, flash 9, correct?)
Obviously I knew there'd be changes and updates and the like, and I've been
able to go through the tutorials and work out what was given on the CD, and
now I'm making my own. But there's a problem, I can't make buttons. Correction,
I can make buttons, I cannot add action script to anything I make.
I do this:
Insert>New Symbol
Name" "please_work_button"
Type: Button
And I leave the advanced stuff alone. Then I make it look colorful, place it
on the stage and right click it. I select "Actions" and it brings up the
actions window and tells me that "Current Selection cannot have actions applied
to it"
but when I'm using the flash 8 tutorial files (just old flash 8 files saved on
a CD) it has no problem with the buttons there. I also notice that the Actions
window has different menus available for actionscripting.
clbeech - 08 Jul 2008 23:16 GMT
well the problem here is that you 'started' a new file using AS3 - not AS2.
under AS2 you can attach code to Objects in the way you are describing, however
this is not the best method and is discouraged fro a number of reasons - mainly
that it make you code difficult to find, and thus debug, as well as making
paths to other symbols more complex.
you can still in CS3 create AS2 files, and even save them to the Flash 8
format - however it would be in you best interest to either a) learn and use
AS3 (as a new member of the Flash community ;) or b) learn to place your codes
on the timeline which is a far better practice. place your button on the stage
- create a new layer called 'actions' - select the first frame and then open
the actions panel and use the syntax:
myBtn.onPress = function() {
//do your stuff here
}
where 'myBtn' is the instance name of the button you've created (eg.
please_work_button ;)
however if you wish to use AS3 - which has many advantages - the syntax is
quite different and you must use the event listener model but placed on the
timeline just as described above:
function doStuff(event:MouseEvent) {
//do your stuff here
}
please_work_button.addEventListener(MouseEvent.CLICK, doStuff);