Applying FlashEff to movieclips that have been added using addChild?

Posted by andwah73 
Applying FlashEff to movieclips that have been added using addChild?
April 06, 2011 11:04AM
Hi All,

I am trying to add a filter to a movieclip added to stage using addchild. The following code works fine when i drag 'myImage' on stage and give it an instance name of 'myImage_mc' Does anyone know what I am doing wrong here.

Also, I did try a tutorial on adding a TXEFF to dynamicalluy added text box but i could not seem to change the filters, and didnt understand this one.. as follows...

// We need to import the events class for the TXEFF component
import com.jumpeye.Events.TXEFFEvents;
// We need to import some auxiliary classes for the text field.
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;

// Create the target text field and set it up to display
// the text we want.
var txtField:TextField = new TextField();
txtField.type = TextFieldType.DYNAMIC;
txtField.autoSize = TextFieldAutoSize.LEFT;
txtField.selectable = false;
// The NORMAL value is recommended for text anti-alias.
txtField.antiAliasType = AntiAliasType.NORMAL;
// The fonts have to be embedded.
txtField.embedFonts = true;
txtField.x = 100;
txtField.y = 100;
txtField.name = "txtField";
this.addChild(txtField);

// Create the TXEFF component instance using action script
// and set it up to apply the effect on our text field.
var txtEff:TXEFF = new TXEFF();
this.addChild(txtEff);
// First, you need to add the effect component to the Display
// List and only after that, you can set the _targetInstanceName
// parameter, otherwise you will get an error message.
txtEff.tweenDuration = 3;
txtEff.patternName = "Blur";
txtEff._targetInstanceName = "txtField";
// This is the preffered way to set the content for a text field
// on which the TxEff component is applied (basic HTML knowledge
// recommended).
txtEff.htmlText = "<p><b><font face=\"Arial\" size=\"20\" color=\"#FFFF00\">This is a text </font></b><i><font face=\"Verdana\" size=\"20\" color=\"#FF0000\">for animation...</font></i></p>";

// Add event listeners to the TxEff component instance, so we know
// when the effect starts and when it ends.
txtEff.addEventListener(TXEFFEvents.TRANSITION_START, startHandler);
txtEff.addEventListener(TXEFFEvents.TRANSITION_END, stopHandler);

function startHandler(evtObj:TXEFFEvents):void {
trace("Transition has started...");
}

function stopHandler(evtObj:TXEFFEvents):void {
trace("Transition has stopped...");
}

Thanx
Andy

stop();
import flash.display.MovieClip;
import flash.display.DisplayObjectContainer;

var myImage_mc : myImage = new myImage();
addChild(myImage_mc);

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.filter.reflection.FEFReflection;

var effect:FlashEff2Code = new FlashEff2Code();
addChild(effect);

var reflection:FEFReflection = new FEFReflection();
reflection.refresh = false;
reflection.reflectionAlpha = 0.8;
reflection.reflectionRatio = 160;
effect.addFilter(reflection);
effect._targetInstanceName = "myImage_mc";
Re: Applying FlashEff to movieclips that have been added using addChild?
April 06, 2011 11:06AM
Sorry..... here is my code which does not work at present

stop();
import flash.display.MovieClip;
import flash.display.DisplayObjectContainer;

var myImage_mc:myImage = new myImage();
addChild(myImage_mc);


import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.filter.reflection.FEFReflection;

var effect:FlashEff2Code = new FlashEff2Code();
addChild(effect);

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

effect.addFilter(reflection);

effect._targetInstanceName = "myImage_mc";
Re: Applying FlashEff to movieclips that have been added using addChild?
April 06, 2011 01:29PM
Instead of effect._targetInstanceName = "myImage_mc"; use effect.target= myImage_mc
Sorry, you do not have permission to post/reply in this forum.