Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 16-12-2004, 14:44   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2003
Beiträge: 377
emptyMovieclip und mausposition

hi leute,

ich hab hier dieses script. das erzeugt mir den movieclip square, und hängt den an die maus ran. allerdings klebt die maus an der linken oberen ecke des square. ich möchte aber, dass die maus in der mitte steht. was muss ich da im as angeben? kann mir jemand bitte helfen? danke!

ActionScript:
  1. onClipEvent (load) {
  2.     _root.createEmptyMovieClip('square', 0);
  3.     function drawSquare() {
  4.         x = _root._xmouse;
  5.         y = _root._ymouse;
  6.         with (_root.square) {
  7.             // clear();
  8.             moveTo(x+70, y-15);
  9.             beginFill(0x000088);
  10.             lineTo(x+5, y-5);
  11.             lineTo(x+5, y+5);
  12.             lineTo(x-5, y+5);
  13.             endFill();
  14.         }
  15.     }
  16.     _root.maskee.setMask(_root.square);
  17. }
  18. onClipEvent (mouseMove) {
  19.     drawSquare();
  20.     updateAfterEvent();
  21. }
stifflers mum ist offline   Mit Zitat antworten
Alt 16-12-2004, 15:10   #2 (permalink)
Muecke_Romeo
Gast
 
Beiträge: n/a
Da erzähl ich dir bestimmt nix neues, aber eigendlich musst du nur nach dem Erstellen von Square direkt die Position von Square mit der Mausposition abgleichen und von dieser die Hälfte von Square's Breite und Höhe abziehen.

PHP-Code:
onClipEvent (load) { 
    
_root.createEmptyMovieClip('square'0); 
    function 
drawSquare() { 
        
_root._xmouse
        
_root._ymouse
        
with (_root.square) { 
            
// clear(); 
            
moveTo(x+70y-15); 
            
beginFill(0x000088); 
            
lineTo(x+5y-5); 
            
lineTo(x+5y+5); 
            
lineTo(x-5y+5); 
            
endFill(); 
            
_root.square._x=_root._xmouse-(_root.square._with /2);
            
_root.square._y=_root._ymouse-(_root.square._height /2);
        } 
    } 
    
_root.maskee.setMask(_root.square); 

onClipEvent (mouseMove) { 
    
drawSquare(); 
    
updateAfterEvent(); 

Habs net probiert, aber die einfachsten Methoden sind oft die Besten
  Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 10:54 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele