Text effects not working

Posted by user885841 
Text effects not working
August 23, 2011 08:20PM
Hello,
I am trying to add text effects using AS3. I am using CS5.5 on Windows 7. The effects work fine when I add them at design time. When I run the following code, everything compiles without errors, but the text is not visible. If I put listeners on the begin and end events for the effect, I can see that they are beginning and ending as expected, but the text is not visible. My framerate is set to 30fps. I have the following in my library: FlashEff2Code, FlashEff2ShowHide, FlashEff2ShowHideMC, FETXYScale, and FETMagneticWind.

The code works fine (ie. the TextField is created and formatted properly) if I comment out the line:
effect.target = myText;

but of course, that is the line that needs to work! As soon as I uncomment that line and publish, the text is not visible.

Any help greatly appreciated!


import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.flashEff2.text.magneticWind.FETMagneticWind;
import com.jumpeye.flashEff2.text.xyscale.FETXYScale;

var myText:TextField = new TextField();
	myText.type = TextFieldType.DYNAMIC;
	
	myText.width = 130;
	myText.height = 200;
	myText.selectable=false;
	myText.multiline = true;
	myText.wordWrap=true;
	myText.antiAliasType = "advanced";
	
	
	addChild(myText);
	
	var formatSplashText:TextFormat = new TextFormat();
	formatSplashText.font = "_sans";
	formatSplashText.size = 14;
	myText.textColor = Number(0xff0000);
    myText.defaultTextFormat = formatSplashText;
				 
	myText.htmlText="The quick brown fox jumps over the lazy brown dog.";
	
	
	
// Create the FlashEff2Code instance and add it to the stage. The FlashEff2Code
// component must be in the display list in order for it to work.
var effect:FlashEff2Code = new FlashEff2Code();
effect.addEventListener(FLASHEFFEvents.TRANSITION_END, replay);
addChild(effect);
// Create the show pattern instance (FESBrightSquares) and set it
// so the effect looks as you like.
var showEffect:FETMagneticWind = new FETMagneticWind();
showEffect.randomX = 200;
showEffect.randomY = 50;
showEffect.groupDuration = 1.5;
showEffect.tweenDuration = 2;
// Create the hide pattern instance (FESEqualizer) and set it
// so the effect looks as you like.
var hideEffect:FETXYScale = new FETXYScale();
hideEffect.positionX = -15;

hideEffect.positionY = -50;
hideEffect.preset = 9; // char: random
hideEffect.groupDuration = 1.5;
hideEffect.tweenDuration = 2;
// Assign the show and hide transitions to the FlashEff2Code instance.
effect.showTransition = showEffect;
effect.hideTransition = hideEffect;
// There will be a 3 seconds pause between the show and hide transitions.
effect.hideDelay = 3;
// Set the target text field to the FlashEff2Code instance. Once you do this,
// the show effect will start immediately (except the case when the
// show effect has a delay too).
effect.target = myText;
// When the "hide" transition ends, start the show effect again.
function replay(evt:FLASHEFFEvents):void {
	if (effect.currentTransitionType == "hide") {
		effect.show();
	}
}



Edited 2 time(s). Last edit at 08/23/2011 11:23PM by user885841.
Re: Text effects not working
August 24, 2011 12:21PM
Did you embedded the font that you are using in your library?
_sans font cannot be embedded. Try to use a normal font.
Re: Text effects not working
August 25, 2011 05:46AM
Thank you very much, I had not properly embedded the font.
Re: Text effects not working
June 06, 2015 10:40AM
It will be beneficial to anybody who utilizes it, including me. Very efficiently written information. Keep up the good work.
Have A Look
Re: Text effects not working
October 08, 2015 06:03AM
Your workout consistently drawn attention and create impactful thoughts on my mind.Thanks for sharing
Double Wirelass Remote For Exit: [bluefield.com.tw]



Edited 1 time(s). Last edit at 10/08/2015 06:05AM by user1647739.
Sorry, you do not have permission to post/reply in this forum.