Mouse onMouseMove [AS 2] 
Klasa: Mouse
Kompatybilność: ActionScript 1.0, Flash 5+
Wykonuje się, gdy myszka się porusza.
Aby użyć zdarzenia onMouseDown , musisz najpierw stworzyć obiekt sluchacza. Możesz wtedy określić funkcję jaka ma się wykonywać po zdarzeniu, musisz równiez połączyć słuchacza z wydarzeniem po przez użycie addListener(), tak jak to pokazano poniżej:
var sluchacz:Object = new Object();
sluchacz.onMouseDown = function () { ... };
Mouse.addListener(sluchacz);
Możliwe jest również dodanie kliku zdarzeń do jednego słuchacza.
Listing
//Podany przykład tworzy z Flasha narzędzie do rysowania
this.createEmptyMovieClip("ksztalt_mc", this.getNextHighestDepth());
var sluchacz:Object = new Object();
sluchacz.onMouseDown = function() {
this.isDrawing = true;
this.orig_x = _xmouse;
this.orig_y = _ymouse;
this.target_mc = ksztalt_mc.createEmptyMovieClip("", ksztalt_mc.getNextHighestDepth());
};
sluchacz.onMouseMove = function() {
if (this.isDrawing) {
this.target_mc.clear();
this.target_mc.lineStyle(1, 0xFF0000, 100);
this.target_mc.moveTo(this.orig_x, this.orig_y);
this.target_mc.lineTo(_xmouse, this.orig_y);
this.target_mc.lineTo(_xmouse, _ymouse);
this.target_mc.lineTo(this.orig_x, _ymouse);
this.target_mc.lineTo(this.orig_x, this.orig_y);
}
updateAfterEvent();
};
sluchacz.onMouseUp = function() {
this.isDrawing = false;
};
Mouse.addListener(sluchacz);
        	this.createEmptyMovieClip("ksztalt_mc", this.getNextHighestDepth());
var sluchacz:Object = new Object();
sluchacz.onMouseDown = function() {
this.isDrawing = true;
this.orig_x = _xmouse;
this.orig_y = _ymouse;
this.target_mc = ksztalt_mc.createEmptyMovieClip("", ksztalt_mc.getNextHighestDepth());
};
sluchacz.onMouseMove = function() {
if (this.isDrawing) {
this.target_mc.clear();
this.target_mc.lineStyle(1, 0xFF0000, 100);
this.target_mc.moveTo(this.orig_x, this.orig_y);
this.target_mc.lineTo(_xmouse, this.orig_y);
this.target_mc.lineTo(_xmouse, _ymouse);
this.target_mc.lineTo(this.orig_x, _ymouse);
this.target_mc.lineTo(this.orig_x, this.orig_y);
}
updateAfterEvent();
};
sluchacz.onMouseUp = function() {
this.isDrawing = false;
};
Mouse.addListener(sluchacz);
Dodano przez: divix  
Ranga: Administrator serwisu Punktów: 0
Ranga: Administrator serwisu Punktów: 0
Komentarze użytkowników
:: Losowe artykuły 

:: Wymiana linków 
    
	Modowe inspiracje |
        Android Gry i Aplikacje |
        ZaplanujTransport.pl: Przeprowadzki, transport, aukcje |
        Logo dla firmy |
        Change Tires - Car Weather Forecast Reminder |
        Laminas: MVC Framework for PHP |
        IT Books Reviews and Programming: JS, JAVA, PHP, ANDROID, CSS | 
        Katalog roślin |
        Programming articles: JAVA, PHP, C++, Python, JavaScript |
        Kancelaria Adwokacka Łukasz Huszno
        
    

 
  
				

 
                             
 


 
                        
 
		 
	