Rollover (FLASHEFFEvents.ROLL_OVER) event not firing

Posted by ikanski 
Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 22, 2010 09:48PM
I just posted a reply in another topic with example code for this event, but I think this problem is serious enough to have its own topic.

The example code in the ActionScript3.0 Usage.pdf (and the other forum topic here regarding roll over effects on movieclips) do not work -- the FLASHEFFEvents.ROLL_OVER event does not fire. I've checked and rechecked all of naming, library items, and there are also no compile errors.

I'm using FlashEff2 Premium in Flash CS4 on Mac OS 10.6.2

Any ideas, or updated code out there with a working example of using the FLASHEFFEvents.ROLL_OVER event?

Here's the code from the component's PDF on page 53:

import com.jumpeye.Events.FLASHEFFEvents; 
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;

var myPattern:FESAlpha = new FESAlpha(); 
var myEffect:FlashEff2Code = new FlashEff2Code(); 

myEffect.showTransition = myPattern; 
myEffect.showDelay = 2; 

this.addChild(myEffect); 
myEffect._targetInstanceName = "myClip";

myEffect.addEventListener(FLASHEFFEvents.ROLL_OVER, rollOverHandler); 
myEffect.addEventListener(FLASHEFFEvents.ROLL_OUT, rollOutHandler);

function rollOverHandler(evtObj:FLASHEFFEvents):void {
trace("ROLL OVER on target object");
}
function rollOutHandler(evtObj:FLASHEFFEvents):void { 
trace("ROLL OUT on target object");
}
Re: Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 24, 2010 09:07AM
ikanski,

There is an error in the As3 usage documentation file because The FLASHEFFEvents.ROLL_OVER and FLASHEFFEvents.ROLL_OUT events are dispatched only along with the FEButton effects and with the flasheff commands. Thank you for bringing that issue in our attention and really sorry for any inconvenience. We will fix the documentation with the next major update. The solution for you would be to use the Mouse rollover and rollout events instead of the falsheeff events :

myEffect.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
myEffect.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);

function rollOverHandler(evtObj:FLASHEFFEvents):void {
trace("ROLL OVER on target object");
}
function rollOutHandler(evtObj:FLASHEFFEvents):void {
trace("ROLL OUT on target object");
}
Re: Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 24, 2010 02:33PM
Ok, glad to know there's an easy solution, thanks.
Re: Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 24, 2010 04:23PM
ikanski,

You are welcome!
Re: Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 24, 2010 05:28PM
So I applied your suggestion, and the rollover event is triggered, but I get this error and my effect is still not applied:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at FlashEff2/addFilter()
	at logo_fla::MainTimeline/rollOverHandler()

Here's my code:
var roEffect:FlashEff2Code = new FlashEff2Code();

addChild(roEffect);

my_mc.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);

function rollOverHandler(evtObj:MouseEvent):void{

	var reflection:FEFReflection = new FEFReflection(); 
	reflection.refresh = false;
	reflection.reflectionAlpha = 0.8;
	reflection.reflectionRatio = 160;
	
	roEffect.addFilter(reflection);

	roEffect._targetInstanceName = "my_mc";
}

I've verified that neither "roEffect" or "reflection" objects are null inside the 'rollOverHandler', so maybe it's the "addFilter()" that is causing the error?
Re: Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 24, 2010 05:50PM
Found the solution: call addFilter() after setting the _targetInstanceName.
Re: Rollover (FLASHEFFEvents.ROLL_OVER) event not firing
February 26, 2010 09:57AM
ikanski,

Glad to hear you have found the solution.
Sorry, you do not have permission to post/reply in this forum.