A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Roll_over & Roll_out

  1. #1
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55

    Roll_over & Roll_out

    Hello,

    I have a navigation section that i want to fade in whenever the entire navsection has an active cursor over it. The navsection also includes a series of button_mc's that allow the user to navigate.

    I have the Nav Section (instance named bg) animating properly, but whenever i move from 1 button to the next, it replays the alpha fade in.

    Here's my code:

    Code:
    package {
    
    	import flash.display.*;
    	import flash.net.*;
    	import flash.events.*;
    	import flash.text.*;
    	import fl.transitions.Tween;
    	import fl.transitions.easing.*;
    	import fl.transitions.TweenEvent;
    
    
    	public class Sfgdc extends MovieClip {
    
    		public var sfStat:Boolean = false;
    
    
    		// create a new LocalConnection instance used to send
    		// calls to a LocalConnection instance in another movie
    		var outgoing_lc:LocalConnection = new LocalConnection();
    
    		public function Sfgdc() {
    
    
    
    			visitors.addEventListener(MouseEvent.ROLL_OVER, myOver);
    			visitors.addEventListener(MouseEvent.ROLL_OUT, myOff);
    			visitors.addEventListener(MouseEvent.CLICK, linkVisitors);
    			visitors.buttonMode = true;
    
    			online.addEventListener(MouseEvent.ROLL_OVER, myOver);
    			online.addEventListener(MouseEvent.ROLL_OUT, myOff);
    			online.addEventListener(MouseEvent.CLICK, linkOnline);
    			online.buttonMode = true;
    
    			help.addEventListener(MouseEvent.ROLL_OVER, myOver);
    			help.addEventListener(MouseEvent.ROLL_OUT, myOff);
    			help.addEventListener(MouseEvent.CLICK, linkHelp);
    			help.buttonMode = true;
    
    			textv.addEventListener(MouseEvent.ROLL_OVER, myOver);
    			textv.addEventListener(MouseEvent.ROLL_OUT, myOff);
    			textv.addEventListener(MouseEvent.CLICK, loadError);
    			textv.buttonMode = true;
    
    		}
    
    		function myTrace(event:MouseEvent):void {
    			trace("Home --> Click");
    		}
    		function myOver(event:MouseEvent):void {
    			var myTween:Tween = new Tween(bg.cover_mc, "alpha", Strong.easeIn, 0, 1, .15, true);
    		}
    		function myOff(event:MouseEvent):void {
    			var myTween:Tween = new Tween(bg.cover_mc, "alpha", Strong.easeIn, 1, 0, .15, true);
    		}
    		
    		function linkVisitors(event:MouseEvent):void {
    			trace("Home --> linkVisitors");
    			outgoing_lc.send("Channel", "linkVisitors");
    		}
    		function linkOnline(event:MouseEvent):void {
    			trace("Home --> linkOnline");
    			outgoing_lc.send("Channel", "linkOnline");
    		}
    		function linkHelp(event:MouseEvent):void {
    			trace("Home --> linkHelp");
    			outgoing_lc.send("Channel", "linkHelp");
    		}
    		function linkTextv(event:MouseEvent):void {
    			trace("Home --> linkText");
    			outgoing_lc.send("Channel", "linkText");
    		}
    		function loadError(event:MouseEvent):void {
    			trace("Home --> Error");
    			outgoing_lc.send("Channel", "myError");
    		}
    	}
    }
    So in other words, when i go from 1 button to the next, it plays the ROLL_OUT and creates a flash effect. I'd prefer it that if it was within the main Nav Section it just stayed opaque.

  2. #2
    Member
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    82
    Well, this might not fix it entirely, but it should lessen the effect.

    In the myOver function, replace the starting parameter of the Tween (0) with

    bg.cover_mc.alpha

    And in the myOff function, replace the starting parameter of the Tween (1) with the same thing

    bg.cover_mc.alpha

    All that means is, when you roll onto a button from another, it'll start a Tween to full alpha, but it'll be referring to cover_mc's CURRENT alpha as its starting point, which should still be 1 (from the last button)

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