PDA

View Full Version : Text problem



andriusain
March 26th, 2009, 03:47 PM
Hello all. I have a small problem here and I cannot figure it out for much that I look elsewhere so your help here would be great. I have some text fields inside movieClips that act as buttons. I have some functionality added on mouse over, a color tint is made over the movieClip. I wonder why when I do mouse over the text becomes thinner and uglier.

The code here:
package {

import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.*;
import gs.*;
import flash.events.MouseEvent;

public class Menu extends MovieClip {

private var t1:TextField=new TextField ;
private var t2:TextField=new TextField ;
private var t3:TextField=new TextField ;
private var t4:TextField=new TextField ;

private var m1:MovieClip=new MovieClip ;
private var m2:MovieClip=new MovieClip ;
private var m3:MovieClip=new MovieClip ;
private var m4:MovieClip=new MovieClip ;
var currentButton:MovieClip=null;


var texts:Array=new Array(t1,t2,t3,t4);
var movies:Array=new Array(m1,m2,m3,m4);


public function Menu() {

var myFormatt:TextFormat = new TextFormat();
myFormatt.size=12;
myFormatt.align="center";
myFormatt.color=0xFFFFFF;
myFormatt.font="Arial";

t1.text="PORTFOLIO";
t2.text="INFO";
t3.text="NOTICIAS";
t4.text="CONTACTO";

for (var i:int = 0; i<4; i++) {
texts[i].setTextFormat(myFormatt);

addChild(movies[i]);
movies[i].addChild(texts[i]);
texts[i].selectable=false;
texts[i].height=20;
movies[i].height=20;

movies[i].buttonMode=true;
movies[i].mouseChildren=false;
movies[i].width=texts[i].textWidth+20;
movies[0].x=275;
if (i>0) {
movies[i].x = (movies[i-1].x + movies[i-1].width + 20 );
}
movies[i].y=375;
movies[i].addEventListener(MouseEvent.MOUSE_OVER, over);
movies[i].addEventListener(MouseEvent.MOUSE_OUT, out);
}

function over(evt:MouseEvent):void {
currentButton=MovieClip(evt.currentTarget);
TweenFilterLite.to(currentButton, 1, {colorMatrixFilter:{colorize:0x0098ff, amount:0.3, brightness:1.1}});

}

function out(evt:MouseEvent):void {
currentButton=MovieClip(evt.currentTarget);
TweenFilterLite.to(currentButton, 0.5, {colorMatrixFilter:{amount:0}});
}

}

}


}

As always thank you for your support!

Andres.

creatify
March 26th, 2009, 05:16 PM
can you post a screenshot of your text? I'm guessing it has to do with the antialias settings on your textField, but I'm not sure you'll be able to do anything about it. Flash gets finicky with antialiasing, especially regarding the font color on top of the background color behind the font. Due to the color, I've actually had to change the textField.thickness and textField.sharpness upon rollover.

Look into these, maybe play with different settings:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html#antiAliasType

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html#sharpness

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html#thickness

andriusain
March 26th, 2009, 06:00 PM
Here you go, a screenshot. The "PORTFOLIO" and "INFO" buttons show the issue I have, which appears after the roll-over. The other two are how they should be.

Thanks

creatify
March 26th, 2009, 07:13 PM
Here you go, a screenshot. The "PORTFOLIO" and "INFO" buttons show the issue I have, which appears after the roll-over. The other two are how they should be.

Thanks

oh, so it look like you're just loosing the formate? look into defaultTextFormat vs setTextFormat for the initial formatting, see here:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html#defaultTextFormat

andriusain
March 27th, 2009, 09:12 AM
I tried what you suggested with the defaultTextFormat and didn't work but it's something I didn't know so thanks for that. It seems that I am not loosing that text format so it might be something to do with the anti-aliasing. I'll keep trying different things.
Anyways thank you creatify.

Any other thoughts welcome!

Thanks