Action Script 3: Alpha Change on Mouse Rollover
Trying to make it so my text appears when I roll over the image:
gticar.addEventListener( MouseEvent.ROLL_OVER, roll );
function roll ( evt:MouseEvent ) {
gtiText.alpha = 1;
}
What am I doing wrong?
The alpha of the symbol is currently 0.
Full Code View:
import flash.events.MouseEvent;
// Stop the showcase on the homepage (frame 2)
stop();
// Preload sound clip for buttons
var snd:Sound = new Sound();
snd.load(new URLRequest("city-traffic-edit.mp3"));
// Buttons
homeButton.addEventListener( MouseEvent.CLICK, home );
function home( evt:MouseEvent ) {
gotoAndStop(2);
snd.play();
}
galleryButton.addEventListener( MouseEvent.CLICK, gallery );
function gallery( evt:MouseEvent ) {
gotoAndStop(3);
snd.play();
}
mk1Button.addEventListener( MouseEvent.CLICK, mk1 );
function mk1( evt:MouseEvent ) {
gotoAndStop(4);
snd.play();
}
mk2Button.addEventListener( MouseEvent.CLICK, mk2 );
function mk2( evt:MouseEvent ) {
gotoAndStop(5);
snd.play();
}
mk3Button.addEventListener( MouseEvent.CLICK, mk3 );
function mk3( evt:MouseEvent ) {
gotoAndStop(6);
snd.play();
}
mk4Button.addEventListener( MouseEvent.CLICK, mk4 );
function mk4( evt:MouseEvent ) {
gotoAndStop(7);
snd.play();
}
mk5Button.addEventListener( MouseEvent.CLICK, mk5 );
function mk5( evt:MouseEvent ) {
gotoAndStop(8);
snd.play();
}
mk6Button.addEventListener( MouseEvent.CLICK, mk6 );
functi开发者_如何学编程on mk6( evt:MouseEvent ) {
gotoAndStop(9);
snd.play();
}
gticar.addEventListener( MouseEvent.ROLL_OVER, roll );
function roll ( evt:MouseEvent ) {
gtiText:alpha = 1.0;
}
I think, alpha
should be between 0 and 1.
Also try to use visible
property.
The alpha on a TextField which is inherited from DisplayObject ranges from [0..1].
I am also pretty sure that you need to be dealing with a embedded font for this to work, too.
精彩评论