A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [F8] visited button issue

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    14

    [F8] visited button issue

    So I have an invisible button, on top of a movieclip with two frames. I want it to be able to have it show you have visited a button, and for the most part it does that however, I'm getting weird issues whereas if i click on any button, the rest will stick by just rolling over them, without clicking. hard to explain really, here is the example: www.jmfoto.net/whitelabel.html go to "foto" and click on "wedding 1"...here is my as:
    gallerynav_mc.gallery1_btn.onRollOver = function(){
    gallerynav_mc.gallerybutton1_mc.gotoAndStop (2)
    }
    gallerynav_mc.gallery1_btn.onRelease = function(){
    holder.loadMovie("wedding1/1.jpg");
    }

    gallerynav_mc.gallery1_btn.onPress = function() {
    pressed = true;
    gallerynav_mc.gallerybutton1_mc.gotoAndStop(2);
    }
    if (pressed == true) {
    gallerynav_mc.gallerybutton1_mc.gotoAndStop(2);
    }
    gallerynav_mc.gallery1_btn.onRollOut = function() {
    if (pressed == true) {
    gallerynav_mc.gallerybutton1_mc.gotoAndStop(2);
    }
    else {
    gallerynav_mc.gallerybutton1_mc.gotoAndStop(1);
    }
    }

    ....also, is there a simpler way to write all this code for 15 buttons? thank you for your help.

  2. #2
    Member
    Join Date
    Jul 2007
    Posts
    77
    Ok I think the buttons are sticking because 'pressed' is a parent variable that all the buttons are referencing. they each need an individual 'pressed' variable to be specified. You can speed up the code using a loop function

    Code:
    i = 0
    while(i++<15) {
    	gallerynav_mc["gallery"+i+"_btn"].pressed = false;
    	gallerynav_mc["gallery"+i+"_btn"].onRollOver = function() {
    		gallerynav_mc["gallerybutton"+i+"_mc"].gotoAndStop(2);
    	};
    	gallerynav_mc["gallery"+i+"_btn"].onRelease = function() {
    		holder.loadMovie("wedding1/1.jpg");
    	};
    
    	gallerynav_mc["gallery"+i+"_btn"].onPress = function() {
    		gallerynav_mc["gallery"+i+"_btn"].pressed = true;
    		gallerynav_mc["gallerybutton"+i+"_mc"].gotoAndStop(2);
    	};
    	if (gallerynav_mc["gallery"+i+"_btn"].pressed == true) {
    		gallerynav_mc["gallerybutton"+i+"_mc"].gotoAndStop(2);
    	}
    	gallerynav_mc["gallery"+i+"_btn"].onRollOut = function() {
    		if (gallerynav_mc["gallery"+i+"_btn"].pressed == true) {
    			gallerynav_mc["gallerybutton"+i+"_mc"].gotoAndStop(2);
    		} else {
    			gallerynav_mc["gallerybutton"+i+"_mc"].gotoAndStop(1);
    		}
    	};
    }
    Last edited by ugoDesigns; 07-30-2007 at 10:54 PM.
    www.ugonna-nwosu.com
    If at first you don't succeed... Try not to look suprised.

  3. #3
    Junior Member
    Join Date
    Jul 2007
    Posts
    14
    I greatly appreciate your response. I understand what you mean but I dont know how to do it. I tried to use your coding but unfortunately it did not work. I doubt it but does it matter that I only have one mc i used under the button, just copied to the stage with different instance names? I really appreciate the help.

  4. #4
    Member
    Join Date
    Jul 2007
    Posts
    77
    Sorry it didn't work. Any chance I could see the fla file? The code I wrote is dependent on you naming the instances as follows:
    gallery1_btn
    gallery2_btn
    gallery3_btn etc...

    gallerynav_mc.gallerybutton1_mc
    gallerynav_mc.gallerybutton2_mc
    gallerynav_mc.gallerybutton3_mc etc..

    Like say I'd have a better chance of solving the problem if I could see the detup you have.
    www.ugonna-nwosu.com
    If at first you don't succeed... Try not to look suprised.

  5. #5
    Junior Member
    Join Date
    Jul 2007
    Posts
    14
    thank you very much for your effort, here is the file, let me know if your not using mx....
    Attached Files Attached Files

  6. #6
    Junior Member
    Join Date
    Jul 2007
    Posts
    14
    anybody? up for the challenge??

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