A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Having trouble with basic actionscript

  1. #1
    Member
    Join Date
    Dec 2003
    Location
    Colorado
    Posts
    94

    Having trouble with basic actionscript

    I am making a navigation panel for a project. The mouse clicks the symbol, and the symbol changes, slides over, and a panel fades in. When the user clicks again, the symbol changes again. However, the last command will not work. Any suggestions?
    Attached Files Attached Files
    When it comes to believing in god, I relaly tried
    -George Carlin
    I guess heartbreak's a fire, and I got burned
    -Home Grown

  2. #2
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    put this on your symbol in frame 22:

    code:

    on(press) {
    _root.gotoAndStop("22");
    }
    on(rollOut) {
    _root.gotoAndStop("1");
    }



    you needed the _root in there

    Adam

  3. #3
    Member
    Join Date
    Dec 2003
    Location
    Colorado
    Posts
    94
    What exactly does the "root" do? I've seen it in many an actionscript code.
    When it comes to believing in god, I relaly tried
    -George Carlin
    I guess heartbreak's a fire, and I got burned
    -Home Grown

  4. #4
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    _root refers to the main timeline...so if you want the main timeline to play you need _root.gotoAndPlay(22)...also, if you create a movie clip and then place it on the main timeline you can get at it by giving it an instance name and using _root.movieClipInstanceName.gotoAndPlay(10)..this will play the 10th frame of that movieclip..._root isn't always necessary, but it's good habit to get into when using anything on the main timeline.

    this make sense?

    Adam

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    It's also better to use labeled frames rather than frame numbers...

  6. #6
    Member
    Join Date
    Dec 2003
    Location
    Colorado
    Posts
    94
    With that in mind...How can I fix the file as a rollOver instead of onPress? I tried making the symbol an independent button and a movie clip inside the button, but that didn't work either.
    Attached Files Attached Files
    When it comes to believing in god, I relaly tried
    -George Carlin
    I guess heartbreak's a fire, and I got burned
    -Home Grown

  7. #7
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    Ok, I had a look....what exactly do you want it to do onRollver and rollOut?

    Adam

  8. #8
    Member
    Join Date
    Dec 2003
    Location
    Colorado
    Posts
    94
    On rollOver, I want the "communication" bar to fade in as the symbol slides out. On rollOut, I want it to do the exact opposite.
    When it comes to believing in god, I relaly tried
    -George Carlin
    I guess heartbreak's a fire, and I got burned
    -Home Grown

  9. #9
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    Ok, I took everything off your main timeline, and put it in a MC called MC in your library...then I dragged that MC on the stage and used a code that detects the frames in that MC...it plays while you're over the MC, and then plays backwards when you roll off....is this what you were looking for?

    Adam
    Attached Files Attached Files

  10. #10
    Member
    Join Date
    Dec 2003
    Location
    Colorado
    Posts
    94
    That's a corrupted zip file, could you upload it as a fla?
    When it comes to believing in god, I relaly tried
    -George Carlin
    I guess heartbreak's a fire, and I got burned
    -Home Grown

  11. #11
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    sure
    Attached Files Attached Files

  12. #12
    Member
    Join Date
    Dec 2003
    Location
    Colorado
    Posts
    94
    Thank you very much.
    When it comes to believing in god, I relaly tried
    -George Carlin
    I guess heartbreak's a fire, and I got burned
    -Home Grown

  13. #13
    Senior Member Adam14's Avatar
    Join Date
    Feb 2004
    Location
    Ontario Canada
    Posts
    1,116
    You're mighty welcome!

    Adam

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