Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 28-10-2003, 15:05   #1 (permalink)
°t____
 
Registriert seit: Dec 2001
Ort: Kiel
Beiträge: 24
Question dynamische Bilder mit draw API maskieren

Ahoi,
ich möchte attachMovie vermeiden um alles ein bisschen offener zu haben. Das geht bestimmt...jemand 'ne Idee?


was bisher geschah:

ActionScript:
  1. function image(n,width,height,xpos,ypos,path,depth){
  2.  
  3.   createEmptyMovieClip(n,depth);
  4.   loadMovie(path,_root[n])// Hier kommt das Bild
  5.   _root[n]._x=xpos;
  6.   _root[n]._y=ypos;
  7.  
  8.   _root.createEmptyMovieClip( n + depth, depth + 1000 );
  9.   with (_root[n + depth]){  // Jetzt die Maske zeichnen
  10.     beginFill (0xFFFFFF, 100);
  11.     lineStyle (1, 0x000000, 100);
  12.     moveTo (xpos, ypos);
  13.     lineTo (xpos + width, ypos);
  14.     lineTo (xpos + width, ypos + height);
  15.     lineTo (xpos, ypos + height);
  16.     lineTo (xpos,ypos);
  17.     endFill();
  18.   }
  19.  
  20.   _root[n].onEnterFrame = function() { // Zum Schluss setMask
  21.     if(_root[n]._width>0){
  22.       _root[n].setMask(_root[n+depth]);
  23.       delete this.onEnterFrame;
  24.     }
  25.   }
  26.  
  27. }

Geändert von kieckbert (29-10-2003 um 10:06 Uhr)
kieckbert ist offline   Mit Zitat antworten
Alt 28-10-2003, 17:28   #2 (permalink)
Steffen G.
 
Benutzerbild von Tschdaeff
 
Registriert seit: Aug 2001
Ort: Ba-Wü
Beiträge: 4.123
was genau ist jetzt das prob bis jetzt?


cu mfg
Tschdaeff
__________________
mod@
www.flashbattle.de
www.steffen-guse.de
------------------------------------

Tschdaeff ist offline   Mit Zitat antworten
Alt 29-10-2003, 10:03   #3 (permalink)
°t____
 
Registriert seit: Dec 2001
Ort: Kiel
Beiträge: 24
...mein Prob ist folgendes:

ActionScript:
  1. width=200;
  2. height=300;
  3. xpos=0;
  4. ypos=0;
  5. path="test.jpg";
  6. depth=1;
  7.        
  8. createEmptyMovieClip("n",1);
  9. loadMovie(path,_root.n)// Hier kommt das Bild
  10. _root.n._x=xpos;
  11. _root.n._y=ypos;
  12.  
  13. _root.createEmptyMovieClip( "heinz", 2 );
  14. with (_root.heinz){  // Jetzt die Maske zeichnen
  15.     beginFill (0xFF0000, 100);
  16.     lineStyle (1, 0x000000, 100);
  17.     moveTo (xpos, ypos);
  18.     lineTo (xpos + width, ypos);
  19.     lineTo (xpos + width, ypos + height);
  20.     lineTo (xpos, ypos + height);
  21.     lineTo (xpos,ypos);
  22.     endFill();
  23.   }
  24.        
  25. _root.heinz.onEnterFrame = function() { // Zum Schluss setMask
  26.  
  27.     if(_root.n._width>0){
  28.     _root.n.setMask(_root.heinz);
  29. delete this.onEnterFrame;
  30.  
  31.     }
  32. }

das funktioniert ABER den ganzen kram als ein Objekt, das funktioniert nicht. Ich Seh meinen ground und meine maske aber setmask geht nicht.
kieckbert ist offline   Mit Zitat antworten
Alt 29-10-2003, 10:18   #4 (permalink)
°t____
 
Registriert seit: Dec 2001
Ort: Kiel
Beiträge: 24
OK...Problem beseitigt -
ActionScript:
  1. _root[n].onEnterFrame = function()
muss
ActionScript:
  1. _root.onEnterFrame = function()
heißen, dann flutscht's.
kieckbert ist offline   Mit Zitat antworten
Alt 29-10-2003, 10:24   #5 (permalink)
Level up
 
Benutzerbild von Alois
 
Registriert seit: Jun 2001
Ort: Bocholt
Beiträge: 4.155
So denn:
ActionScript:
  1. function image(n,width,height,xpos,ypos,path,depth){
  2.        
  3.         createEmptyMovieClip(n,depth);
  4. _root[n].createEmptyMovieClip("image",1);
  5.        _root[n].image.loadMovie(path)// Hier kommt das Bild
  6.         _root[n]._x=xpos;
  7.         _root[n]._y=ypos;
  8.        
  9.         _root[n].createEmptyMovieClip( "maske", 2);
  10.         with (this[n].maske){  // Jetzt die Maske zeichnen
  11.                 beginFill (0xFFFFFF, 100);
  12.                 lineStyle ();//linien in masken haben eh keine Wirkung
  13.                 moveTo (0, 0);//kann auch entfallen
  14.                 lineTo (width, 0);
  15.                 lineTo (widthheight);
  16.                 lineTo (0, height);
  17.                 lineTo (0,0);
  18.                 endFill();
  19.         }
  20.        
  21.         _root[n].onEnterFrame = function() { // Zum Schluss setMask
  22.                 if(this.image.width>0){
  23.                         _root[n].image.setMask(_root[n].maske);
  24.                         delete this.onEnterFrame;
  25.                 }
  26.         }
  27.        
  28. }


Gruß

Alois

Edit: denk mal drüber nach, ob Du nicht alle _root's rauskürzen kannst
Edit: nr.2 oh ja sorry der oEF im mc 'image' wird ja durch loadMovie überschrieben.... geändert
__________________
-Spuckt mir auf den Stuhl, ich will im Grünen sitzen-

Geändert von Alois (29-10-2003 um 10:56 Uhr)
Alois ist offline   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 08:22 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele