| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Senior Member
|
actionscript linking problem
I'm sure this question has been asked dozens of times before, but I can't find a decent answer to it. On flash cs3 with actionscript 3.0, how do I apply actionscript to a button. With 2.0 It's possible but with 3.0 I get this selection can't have actions applied to it. |
|
|
|
|
|
#2 (permalink) |
|
Battery Chicken
|
create a class for that flash document. and then include that class file in the "Document Class:" field in the properties. if it was called Main.as, and you had a button on the root timeline with an instance name of "my_but" then you can do something like. Code:
of course replace the trace action with whatever you want to happen. also, i haven't tested this code, i just pulled it out of my_but :P though it should work. btw. how do you tab text in the browser input text areas? hth |
|
|
|
#4 (permalink) |
|
Battery Chicken
|
this is how to 'just add actions to a button' welcome to AS3 ! this way seems more complex, but in the long run, it saves tons of headaches... headaches like hunting for keyframes and buttons to click on just to find an erroneous code. but in most simple cases. why not just stick with AS2 + timeline ? |
|
|
|
#5 (permalink) |
|
Senior Member
|
I've got it working. I used this code. Code:
Well this is the first time i've used flash since mx 2004. I can understand why it's easier to have all your script in one location than all over the place. Just takes a bit of getting used to that's all. I was close to switching it to AS2 but that would be the easy way out, it's always good to learn new stuff aswell. Thanks for the help anyways. |
|
![]() |