Results 1 to 9 of 9

Thread: Buttons in Flash

  1. #1
    Join Date
    Jan 2007
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Buttons in Flash

    Hello...

    Ok, my newest hangup

    What is the simplest way to transition betwen pages of a webpage in flash?
    I'm creating a flash based website with buttons etc...

    I would like there to be transitions between the pages of the webpage. I've animated in and out states for these animations within each of the pages. If I were to play the "home" movieclip from start to finish the effect would be transition in >> content >> transition out.

    Now, anytime I click on another button from the home page, I'd like the transition out of the home to play followed by the transition in of whatever page's link was clicked on. This wouldn't be hard if i were talking of one or two buttons. But I have quite a few.

    I could create seperate actionscript for each link on each page to get the effect I suppose, but i was wondering if there was a simpler way to do it, using some sort of "if" statement perhaps.

    In short, the actionscript should do the following.

    when a link is clicked:

    1. Determine which movie clip is on the screen (each of my pages is within a mc called home, bio, portfolio etc...) and play its "out" state (labeled such in a labels layer)
    2. Determine which link has been clicked and play its "in" state (in states start at frame 1 so a simple gotoandplay statement will do)

    Using Flash 8

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    One way is to set an invisible variable in each of the pages "content" section. So where you have in>>content>>out, you should have a stop(); action on the content section of each.

    add this below the stop();
    Code:
    var content:Number = 1;
    just increment it for each (Number = 2, Number = 3, etc..)

    then on the button have something like:
    Code:
    on(release){
       if (_root.content == 1){
          _root.nameOf_MC with 1 as content#.gotoAndPlay("outframeLable");
                  if (_root.nameOf_MC with 1 as content#._currentframe == ("endframe#"){
                      _root.content = 0;
                      _root.nameOf_MC with 2 as content#.gotoAndPlay("frameNumber_of_content");
                      }
           }
       else if (_root.content == 2){
          _root.nameOf_MC with 2 as content#.gotoAndPlay("outframeLable");
                  if (_root.nameOf_MC with 2 as content#._currentframe == ("endframe#"){
                      _root.content = 0;
                      _root.nameOf_MC with 3 as content#.gotoAndPlay("frameNumber_of_content");
                      }
           }
    //continue for all buttons
    };
    This isn't perfect, but I have only been awake for 20 minutes It should give you the idea though.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jan 2007
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Wow...you're dedicated blizzard. Helping me out right after you get up, I really appreciate that.

    I was hoping that maybe you could give me an example of how this might work. I'm having some issues in implementing it.

    I'm attaching a basic mock-up of my site so you don't have to create anything from scratch.

    Thanks a lot.

    Attachment 846

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    After looking at your movie, I made a few changes to my original post.

    You were close, and had the right idea. We needed to basically add 3 actions to one button.

    It is live and working here (attached below) Take a look at the actions panel on frame 1, the actions on each button, AND the actions on the last frame (21) of EACH p1, p2, etc MC.

    Enjoy.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jan 2007
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you Blizzard.

    You are my hero!

    A follow-up question:

    How do i tweak it if the 1st frame w/ the navigation buttons is not the first frame of the flash document.
    I.E. what if the entire animation started on say, frame 5 instead of frame 1.

    it seems not to work in this instance...
    Last edited by V1SHAL; 03-09-2007 at 07:53 AM.

  6. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Have you been able to figure this one out Blizzard?

    I'm very curious to know the fix.

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Oh, yes, sorry, I got busy with my personal sites

    It's an easy fix really. Set your movie up how you need, put everything where you want it. Let's say you are going to have the buttons and what not stat at frame 5, instead of frame 1.

    on the actual page buttons find this line:

    Code:
    } else if (_root._currentframe == "1") {
    change the "1" to "5" then sequentially for each of the other "else if's" on that button. Then change the same lines accordingly for the other 5 buttons.

    so for a full example, the page1 button would have this code:

    Code:
    on (release) {
    	if (_root._cont == 0) {
    		_root.p1.gotoAndPlay("in1");
    	} else if (_root._currentframe == "5") {
    		_root.p1.gotoAndPlay("out1");
    		_root.cont = 1;
    	} else if (_root._currentframe == "6") {
    		_root.p2.gotoAndPlay("out2");
    		_root.cont = 1;
    	} else if (_root._currentframe == "7") {
    		_root.p3.gotoAndPlay("out3");
    		_root.cont = 1;
    	} else if (_root._currentframe == "8") {
    		_root.p4.gotoAndPlay("out4");
    		_root.cont = 1;
    	} else if (_root._currentframe == "9") {
    		_root.p5.gotoAndPlay("out5");
    		_root.cont = 1;
    	} else if (_root._currentframe == "10") {
    		_root.p6.gotoAndPlay("out6");
    		_root.cont = 1;
    	}
    }
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  8. #8
    Join Date
    Jan 2007
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks Blizzard!

    As always, you've saved me!

  9. #9
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    You are welcome

    Glad it all works for you
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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