How to use the library FlashEff SWF

Posted by junhuanet 
How to use the library FlashEff SWF
January 12, 2010 05:26AM
package 
{
	import com.jumpeye.flashEff2.core.interfaces.IFlashEffSymbolText;
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;

	public class Test extends Sprite 
	{
		public function Test()
		{
			addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
		}
		
		private function onAddedToStageHandler(event:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
			var context:LoaderContext = new LoaderContext();
			context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderCompleteHandler);
			loader.load(new URLRequest("flasheff.swf"),context);
		}
		
		private function onLoaderCompleteHandler(event:Event):void 
		{
			var lib:LoaderInfo = event.target as  LoaderInfo;
			var PatternClass:Class = lib.applicationDomain.getDefinition("com.jumpeye.flashEff2.symbol.alpha.FESAlpha");
			var effect:FlashEff2 = new FlashEff2();
			addChild(effect);
			var pattern:IFlashEffSymbolText = new PatternClass() as IFlashEffSymbolText;
			effect.showTransition = pattern;
		}
	}
	
}

FLASHEFF2 ERROR: ReferenceError: Error #1065:variable FESAlpha is not defined?
at FlashEff2/transitionEffect()
at FlashEff2/draw()
at com.jumpeye.core::JUIComponent/callLaterDispatcher()


What reason is this?
Re: How to use the library FlashEff SWF
January 22, 2010 03:33PM
Junhuanet,

The reason of your error is because you load the flasheff.swf in another new context, and the child can use the loader's context but in your example the loader needs the child's context. So you have to use :

context.applicationDomain = ApplicationDomain.currentDomain;

Beni.
Sorry, you do not have permission to post/reply in this forum.