A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Easy ActionScript help - Nested buttons

  1. #1
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57

    Easy ActionScript help - Nested buttons

    I am trying to make this button point to a new scene.

    Here is how the button is put together:
    NavGigs (button) inside links (graphic) --> navLinks (movie clip) --> News (scene)

    So down in the library, I opened up links, clicked on NavGigs, and assigned an action to it.

    Here is the action:
    on (release) {
    gotoAndPlay("Gigs", 1);
    }
    on (rollOver) {
    tellTarget ("movingTicket") {
    play();
    }
    }
    on (press, rollOut) {
    tellTarget ("movingTicket") {
    gotoAndPlay(14);
    }
    }


    Now, the thing is, everything works except that first on (release). I'm trying to get it to go to scene "Gigs" and play frame 1, but it doesn't move at all.

    To double check things, I dragged a new instance of the button onto the stage (not inside navLinks --> links) and assigned the appropriate action, and it worked perfect. So I'm guessing this has to do with the fact that this button has been nested far into the movie. How can I ActionScript my way out of this?

  2. #2
    junior master chef j_hunter182's Avatar
    Join Date
    Jun 2003
    Location
    Hull, East Yorkshire, UK
    Posts
    556
    welcome to flashkit.

    try posting this in the actionscript forum , thats where all the AS experts live (literally). im sure one of the coffee lounge mods will move this for you so you can get some better answers.
    jh

  3. #3
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57
    Oops, sorry. Thanks. I've been to FlashKit a number of times for tutorials, but I guess I didn't notice this was out of place.

    Thanks for helping me out.

  4. #4

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You can't target scene names from anywhere else than on the main timeline. So forget about targeting scene names for ever again.
    Target a labeled frame instead. Thus label frame 1 of your "Cigs" scene with an unique label, such as cigs1 (no number only labels or at least not starting off with a number, and no special character unless maybe the underscore...), add _root to your path, and target that labeled frame on your button's script...
    code:

    on (release) {
    _root.gotoAndPlay("Gigs1");
    }



    Works as a charm!

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