Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [inne] Action Script 3 - problem z kodem "gumki"
-Karolaaa-
post 23.11.2012, 13:19:45
Post #1





Goście







Witam, mam problem z kodem. Otóż dostałam polecenia zrobić "mini painta" jednak nie jestem w stanie zrobić gumki. Próbowałam już na wiele sposób, w końcu doszłam do wniosku, że zrobię ją używając do tego białego koloru. Niestety, po naciśnięciu przycisku Gumka kursor dalej maluje na wybrany wcześniej kolor. Co jest nie tak?

Z góry dziękuję za pomoc

CODE
import flash.display.Sprite;
import fl.controls.*;
import fl.events.*;
import flash.text.TextField;

var kolor:ColorPicker;
var pasek:Slider;
var przycisk:Button;
var rysik:Button;
var Tekst:TextField;
Tekst.text='0';
var tablica:Sprite=new Sprite();


pasek.addEventListener(SliderEvent.CHANGE,wyswietl);
function wyswietl(event):void
{
var tekststring:String = pasek.value.toString();
Tekst.text=tekststring;
}

stage.addEventListener(MouseEvent.MOUSE_DOWN,wyznaczwsp);

function wyznaczwsp(event:MouseEvent):void
{
tablica.graphics.moveTo(mouseX,mouseY);

stage.addEventListener(MouseEvent.MOUSE_UP,koniec);
function koniec(event:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE,rysuj);
stage.removeEventListener(MouseEvent.MOUSE_MOVE,scieraj);
}
stage.addEventListener(MouseEvent.MOUSE_MOVE,rysuj);
stage.addEventListener(MouseEvent.MOUSE_MOVE,scieraj);

function rysuj(event:MouseEvent):void
{
if(mouseY>100)
{
tablica.graphics.lineStyle(pasek.value,kolor.selectedColor,1);
tablica.graphics.lineTo(mouseX,mouseY);
event.updateAfterEvent();
}
else{
stage.removeEventListener(MouseEvent.MOUSE_MOVE,rysuj);
}

}


gumka.addEventListener(MouseEvent.CLICK, scieraj);
function scieraj(event:MouseEvent):void
{
if(mouseY>100)
{
tablica.graphics.lineStyle(pasek.value,0xFFFFFF,1);
tablica.graphics.lineTo(mouseX,mouseY);
event.updateAfterEvent();
}
else
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE,scieraj);
}

}
addChild(tablica);
}
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.04.2024 - 10:30