A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Next and prev buttons not functioning.

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    10

    resolved [RESOLVED] Next and prev buttons not functioning.

    I have a flash file with a MC "wmc" which contains the following script to randomize labels on load as well as for next and prev buttons to function. I used the prev/next btn scipt in a previous file but for some reason the buttons are no longer functioning in this one. I must be missing something elementary! I would greatly appreciate any help any of you could offer. The actual file is available via the following link (see the "workmc" MovieClip in layer "wimages"): http://senduit.com/3aa253

    Code:
    import flash.display.FrameLabel;
    
    function goRandNext(event:MouseEvent = null):void {
    	var labels:Array=currentLabels;
    	for (var i:uint = 0; i < labels.length; i++) {
    		var label:FrameLabel=labels[i];
    		trace("frame " + label.frame + ": " + label.name);
    	}
    	var num:uint=Math.ceil(Math.random()*labels.length-1);
    	label=labels[num];
    	trace(num +" -- "+"frame " + label.frame + ": " + label.name);
    	gotoAndPlay(label.frame);
    }
    
    addEventListener(MouseEvent.MOUSE_UP,goRandNext);
    
    goRandNext();
    
    
    r_btn.addEventListener(MouseEvent.CLICK, nextSection);
    l_btn.addEventListener(MouseEvent.CLICK, prevSection);
    
    function nextSection(event:MouseEvent):void {
    
    var thisLabel:String = currentLabel;
    var thisLabelNum:String = thisLabel.replace("sc", "");
    var curNumber:Number = Number(thisLabelNum);
    if (curNumber < 5) {
    
    var nextNum:Number = curNumber + 1;
    gotoAndStop("sc" + nextNum);
    
    }
    
    }
    
    function prevSection(event:MouseEvent):void {
    
    var thisLabel:String = currentLabel; 
    var thisLabelNum:String = thisLabel.replace("sc", "");
    var curNumber:Number = Number(thisLabelNum);
    var prevNum:Number = curNumber - 1;
    gotoAndStop("sc" + prevNum);
    
    }
    Thank you VERy much, in advance. (I'll have to put this forum on the payroll soon)
    Last edited by vastaso90; 01-09-2010 at 03:20 PM.

  2. #2
    Junior Member
    Join Date
    Jan 2010
    Posts
    10

    Unhappy ...

    anyone... anyone...? The buttons actually work, per se', but they jump to a random frame.

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    10

    Wink I figured it out...

    After some sleep and a coffee, I realized that I had an unnecessary argument:

    Code:
    addEventListener(MouseEvent.MOUSE_UP,goRandNext);
    Thanks anyway to all of you.

Tags for this Thread

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