A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Actionscript 2.0 Buttons?!!?

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Posts
    2

    Actionscript 2.0 Buttons?!!?

    Hey all,

    Having a bit of trouble with actionscript 2.0 in Flash CS3 PRO.

    On scene 1, layer 6, frame 1 I have stopped the animation. On frame 1, I have a button with a title, I want it so when i (press) it goes to frame 2. The problem is that when I test the scene, a syntax error comes up:

    1087: Syntax error: extra characters found after end of program. on (press) {

    I know its something simple, what am I missing. We are just learning it.

    Thanks

    -Calvin

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    when you say the button has a title do you mean an instance name on the properties bar? If so remove the code you applied to the button, then below your stop action on the timeline put this:

    yourbuttontitle.onPress = function(){
    gotoAndStop(2);
    }

    where 'yourbuttontitle' would be replaced with whatever instance name you called your button. Not sure what's wrong with yours without seeing it, but if your just learning i highly recommend doing it this way, much better coding practice.. if you need an example let me know welcome to flashkit
    Evolve Designs Interactive Media
    the natural selection

  3. #3
    Junior Member
    Join Date
    Oct 2007
    Posts
    2
    Hey,

    Thanks for the the code but it isn't working. How come i'm not allowed to right-click on the button and do the actions inside the instance but with CS3 i have to do it in the layer unlike Macromedia Flash. Here is the error:

    1119: Access of possibly undefined property onPress through a reference with static type flash.display:SimpleButton. sceneplay.onPress = function(){

    Its all on the same layer.

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    It sounds like you don't have your publish settings set to Actionscript 2 (they're Actionscript 3 by default in CS3). Are you positive you've set it to Actionscript 2?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center