动作脚本3:鼠标滚动的Alpha更改

时间:2011-04-27 18:27:50

标签: actionscript-3 alpha rollover

尝试将其翻版,以便在我滚动图片时显示文字:

gticar.addEventListener( MouseEvent.ROLL_OVER, roll );
function roll ( evt:MouseEvent ) {
    gtiText.alpha = 1;
}

我做错了什么?

符号的alpha当前为0.

完整代码视图:

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 );
function mk6( evt:MouseEvent ) {
    gotoAndStop(9);
    snd.play();
}

gticar.addEventListener( MouseEvent.ROLL_OVER, roll );
function roll ( evt:MouseEvent ) {
    gtiText:alpha = 1.0;
}

2 个答案:

答案 0 :(得分:0)

我认为,alpha应介于0和1之间 另请尝试使用visible属性。

答案 1 :(得分:0)

继承自TextFieldDisplayObject上的字母范围为[0..1]。

我也很确定你需要处理嵌入式字体才能使用它。