Salve a tutti vorei creare una barra degli strumenti che al clic su un bottone mi cambia il mouse con un'immagine corrispondente al pulsante selezionato ma mi sono un po impantanata con i remove ^-^
per ora ho fatto così:
Codice PHP:
//toolBar
var tools:toolsBr = new toolsBr();
tools.x=370;
tools.y=10;
addChild(tools);
//carico i pulsanti
var bt1:bot1= new bot1();
bt1.x = 10;
bt1.y = 10;
tools.addChild(bt1);
var bt2:bot2= new bot2();
bt2.x = 10;
bt2.y = 10;
tools.addChild(bt2);
//associo le unzioni ai pulsanti
bt1.addEventListener(MouseEvent.CLICK, eventStart1);
bt2.addEventListener(MouseEvent.CLICK, eventStart2);
//per tornare al cursore originale
bt1.addEventListener(MouseEvent.ROLL_OVER, useHand);
bt2.addEventListener(MouseEvent.ROLL_OVER, useHand);
tools.addEventListener(MouseEvent.ROLL_OVER, useHand);
function eventStart1(e:MouseEvent) {
myMc.addEventListener(MouseEvent.MOUSE_MOVE,redrawCursor);
....
}
function eventStart2(e:MouseEvent) {
myMc.addEventListener(MouseEvent.MOUSE_MOVE,redrawCursor2);
....
}
//funzioni per cambiare il cursore
function redrawCursor(event:MouseEvent):void {
Mouse.hide();
cursor.x = event.stageX;
cursor.y = event.stageY;
addChild(cursor);
}
function redrawCursor2(event:MouseEvent):void {
Mouse.hide();
cursor2.x = event.stageX;
cursor2.y = event.stageY;
addChild(cursor2);
}
function useHand(event:MouseEvent) {
Mouse.show();
//this.parent.removeChild(cursor3);
}
mi sa che è un po incasinato, il mio problema è che non so come fare a "cancellare" il cursore caricato quando mi sposto sulla toolbar e rimtterlo quando riesco sullo stage e anche come fare cancellare un cursore per sostituirlo con l'altro.
avete dei suggerimanti?