A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Button help...

  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    54

    Button help...

    I have 4 buttons that are working as links to different parts of a website...

    When I rollover the button it turns from grey to orange...

    When I rolloff it turns from orange back to grey...

    What I want to do is when I CLICK the button i want it to STAY orange so the person viewing the site knows that are currently visiting that section...

    I can't figure out how to do this with the button actions (up,down,over,hit)... and its gotta be possible... theres gotta be an easier way.. other then making it all crazy timelined like i've done in the past...

    I dont want to spend hours doing this a backwards way... I want the real way...

    If someone can help... please help... I've been trying all day!

    thanks

    - mikey

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Maybe this will help.
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    Apr 2004
    Posts
    54

    PERFECT

    Hey... that worked perfectly (not the exact thing i was looking for... but i was able to make so much sense out of it... the buttons had to also have different text in each... so i had to use 4 seperate button mc's...)

    However,

    I've run into another "problem"

    I added this code to the if statements of each button... for example... on button 1 i placed the following code... so the 2nd color on each button couldnt be clicked off back to the first color...

    Code:
    if(_root.b1._currentframe == 20){
    		_root.b1.gotoAndStop(20);
    	}
    In addition to that.... I added this code.. so i could load seperate pages in an empty movie clip... (i.e 'contents')

    Code:
    on(press){
    	_root.contents.loadMovie("about.swf");
    }

    My question is... how do i word this... ok...

    If I click button 1... it turns from grey to orange... and it loads "about.swf"... if I click button 1 again... I want it to STAY orange and NOT reload the "about.swf" movie... currently it stay orange.. but reloads the movie...

    Is there an if statement I can place on that loadMovie code shown above that will NOT load the movie if it already loaded???

    I think that makes sense

    Thanks for any help... youve already helped a HUGE amount!

    - Mikey

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    It would look like this;

    Code:
    on(press){
    	if(_root.b1._currentframe == 10){
    		_root.contents.loadMovie("about.swf");
    		this.gotoAndStop(20);
    	}
    	this.gotoAndStop(20);
    	if(_root.b2._currentframe == 20){
    		_root.b2.gotoAndStop(1);
    	}
    	if(_root.b3._currentframe == 20){
    		_root.b3.gotoAndStop(1);
    	}
    	if(_root.b4._currentframe == 20){
    		_root.b4.gotoAndStop(1);
    	}
    }

  5. #5
    Member
    Join Date
    Apr 2004
    Posts
    54

    perfection yet again

    awesome..

    couldnt be any more perfect...

    thanks alot...

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Woops, typo, that second this.gotoAndStop(20); doesn't belong.

  7. #7
    Member
    Join Date
    Mar 2002
    Posts
    69
    I want to do the same thing with my menu, I've been playing with this code and can't get it right. The "menu" mc is being called in by scrollpane "sp" on the main timeline. "objectivebutton" is the button mc I've been playing with, inside of "menu". I can get it to mouse over and click to the "objective" mc but when I return to the main menu the button state is back to 1, or the up state. How do I make it STICK! I'm only using 2 button states, up and over.

    on(press){
    if(_parent.objectivebutton._currentframe == 1){
    _root.gotoAndPlay("objective");
    _root.objective.gotoAndPlay(1);
    this.gotoAndStop(10);
    }

    if(_parent.objectivebutton._currentframe == 10){
    _root.gotoAndPlay("objective");
    _root.objective.gotoAndPlay(1);
    }
    }
    on(rollover){
    if(_parent.objectivebutton._currentframe == 1){
    this.gotoAndStop(10);
    }
    }
    on(rollout){
    if(_parent.objectivebutton._currentframe == 10){
    this.gotoAndStop(1);
    }
    }

    any help would be appreciated, I'm so close! MISSMETZ

  8. #8
    Member
    Join Date
    Apr 2004
    Posts
    54
    I'm not really good at helping people on flash kit yet... due to the fact I ALWAYS need help...

    But through my anger of trying to get those buttons to work right... I may be of assistance...

    If you look 3 posts up from your post... theres a break down of the code. I used (but read the one under it so you take out that 2nd "gotoandstop"

    I really dont understand what you're trying to do 100%... but if you have 4 mc buttons.. just paste that code there on each button (changing the instance name in each... (i.e b1... b2.. ))

    Using that code... when I rollover... my b1 timeline goes to frame 10... when I rolloff... it goes back to frame 1... and when I click it stays at 20 and load a .swf... if I click another... it will load something else...

    If thats what you're looking for... I don't know why you need those "rollover and rollout commands... that code is already done in your above code...

    I'm sorry... I'm really bad at helping... let me know though... I'd love to finally give back and help someone! maybe re-word it... I may understand if I can get on your same page...

  9. #9
    Member
    Join Date
    Mar 2002
    Posts
    69
    yeah I know what you mean, I always need help too. I have this CBT that has a menu but only appears on the menu page, not throughout the whole course. I understand that when you have a button in a MC, it has to extend the length of the timline in order to work right. The individual button mc's are in "menu" mc, in a scrollpane, I adjusted the timeline length and got it to work as far as clicking to the right MC, but I have this problem now: The button is still in the "mouse over, mouse out" mode after you've clicked it once and then return to the menu, it's lit until you mouse over it again, like it's resetting itself.

    The code above is what I have right now.

    Thanks! Missmetz

  10. #10
    Member
    Join Date
    Mar 2002
    Posts
    69
    I just re-read what you said, and want to add that I like the mouse over effect before you click it, I don't know, it's just me My menu is text with little icons next to it. I suppose I can get rid of the mouse over state, but I have alot of text menu items and think it would help the user see where they are when they scroll down.

    I was also just thinking, I only have the code on one button, should I try another one as well? does it only work with more than one button?
    hmmmm...

    Missmetz

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