Action Script 3: Alpha Ändern auf die Maus-Rollover

Versucht zu machen, damit mein text erscheint, wenn ich die Maus über die Bild:

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

Was mache ich falsch?

Den alpha-das symbol ist derzeit 0.

Vollständigen Code Anzuzeigen:

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;
}
  • Dies ist nicht wirklich im Zusammenhang mit Ihrer Frage, aber, wenn Sie laden Sie Ihre sound ein und klicken Sie auf Anzeige-Objekt, wie homeButton es zu spielen, wie Sie wissen, den sound fertig geladen ist? Sie sollten wahrscheinlich fügen Sie einen Ereignis-listener hört für den sound geladen ist, bevor Sie etwas anderes tun.
InformationsquelleAutor ritch | 2011-04-27
Schreibe einen Kommentar