Hide / Show transitions controlled with a button in flasheff code

Posted by hugoaf 
Hide / Show transitions controlled with a button in flasheff code
March 03, 2011 08:03AM
Hi,

I am trying to run a show transition to a content_mc when mouse is over a btn_mc and also run a hide transition when mouse is out the btn_mc. It seems to work using the code below but I have problems when the mouse is moved fast (before the transition ends I think) the content_mc is not shown correctly or deformed or some times just doesnt desapear from the screen.


content_mc.visible = false;

// Import the necessary classes.
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.scale.FESScale;

btn_mc.addEventListener(MouseEvent.MOUSE_OVER, showContent);
btn_mc.addEventListener(MouseEvent.MOUSE_OUT, hideContent);


function showContent(event:MouseEvent):void {
	var effectIn:FlashEff2Code = new FlashEff2Code();
	addChild(effectIn);
	effectIn.showDelay = 0.1;
	var showEffect:FESScale = new FESScale();
	showEffect.preset = 5; // random
	showEffect.tweenDuration = 0.5;
	showEffect.tweenType='Back';
	showEffect.easeType='easeIn';	
	effectIn.showTransition = showEffect;
	effectIn._targetInstanceName = "content_mc";
}
	
function hideContent(event:MouseEvent):void {
	var effectOut:FlashEff2Code = new FlashEff2Code();
	addChild(effectOut);
	effectOut.hideDelay = 0.1;
	var hideEffect:FESScale = new FESScale();
	hideEffect.preset = 5; // T2B
	hideEffect.tweenDuration = 0.5;
	hideEffect.tweenType='Back';
	hideEffect.easeType='easeIn';
	effectOut.hideTransition = hideEffect;
	effectOut._targetInstanceName = "content_mc";
}

As you may noticed, I am a AS3 newbie. Any help will be appreciated.

Thanks,
Hugo.
Re: Hide / Show transitions controlled with a button in flasheff code
March 03, 2011 12:20PM
Use this code instead:

// Import the necessary classes.
import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.symbol.scale.FESScale;

button_mc.addEventListener(MouseEvent.ROLL_OVER, showContent);
button_mc.addEventListener(MouseEvent.ROLL_OUT, hideContent);
var effectIn:FlashEff2Code = new FlashEff2Code();
	addChild(effectIn);
	effectIn.showAutoPlay=effectIn.hideAutoPlay=false
	effectIn.showDelay = 0.1;
	var showEffect:FESScale = new FESScale();
	
	showEffect.preset = 5; // random
	showEffect.tweenDuration = 0.5;
	showEffect.tweenType='Back';
	showEffect.easeType='easeIn';	
	effectIn.showTransition  =effectIn.hideTransition= showEffect;
	effectIn._targetInstanceName = "content_mc";

function showContent(event:MouseEvent):void {
	
	effectIn.show()
}
	
function hideContent(event:MouseEvent):void {
	
	effectIn.hide()
	
}
Re: Hide / Show transitions controlled with a button in flasheff code
March 03, 2011 08:08PM
It works. Thanks.
Hugo.
Re: Hide / Show transitions controlled with a button in flasheff code
March 07, 2011 08:34AM
You welcome.
Sorry, you do not have permission to post/reply in this forum.