Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 20-01-2004, 08:17   #1 (permalink)
Neuer User
 
Registriert seit: Sep 2003
Ort: Bochum
Beiträge: 37
removeMovieClip von dynmaisch Erzeugtem

Hi,

hab herum getüfftel und verstehe nicht, warum folgendes nicht funktion:
ActionScript:
  1. //FPushButton aus der Bibliothek holen und unsichtbar schalten
  2. _root.attachMovie("FPushButtonSymbol", "knopf_fp", 25);
  3. _root["knopf_fp"]._visible = false;
  4.  
  5. [...]
  6. //Per PHP werden die entsprechenden Variablen geladen
  7.  
  8. //Rechteck_Funktion aufrufen und Namensübergabe des neuen Rechteckenamens.
  9. bastel_untergrund(stat_bez,stations_id,typ_1_label,typ_2_label,typ_3_label);
  10. [...]
  11.  
  12. //Untergründe der Einträge als Rechtecke mit Variablen x | y Werten zeichnen.
  13. function bastel_untergrund(stat_bez,stations_id,typ_1_label,typ_2_label,typ_3_label)
  14. {
  15.     name_des_rechteckes = ""+stations_id;
  16.     x_unter2 = x_unter+580;
  17.     y_unter2 = y_unter+30;
  18.     _root.createEmptyMovieClip(name_des_rechteckes, 2);
  19.     with (_root.name_des_rechteckes)
  20.     {
  21.         if(dicht == "false")
  22.             beginFill (0x009900, 70);
  23.         else
  24.             beginFill (0xC20101, 70);
  25.         lineStyle (2, 0x000000, 100);
  26.         moveTo (x_unter, y_unter);
  27.         lineTo (x_unter2,y_unter);
  28.         lineTo (x_unter2,y_unter2);
  29.         lineTo (x_unter,y_unter2);
  30.         lineTo (x_unter,y_unter);
  31.         endFill();
  32.     }
  33.     level = stations_id + 3;
  34.  
  35. //Hier wird die Funktion aufgerufen, die dazu zuständig ist, den Hauptbutton zu erstellen.
  36.     buttons_erstellen_stat(stat_bez,stations_id,x_kord, y_kord, level,typ_1_label,typ_2_label,typ_3_label);
  37.    
  38.     y_unter += 40;
  39.     y_kord += 40;
  40. }
  41.  
  42. //Dynamischer Button für Station
  43. function buttons_erstellen_stat(stat_bez,stations_id,x_kord, y_kord, level, typ_1_label, typ_2_label, typ_3_label)
  44. {
  45.     //Duplizieren und anpassen
  46.     duplicateMovieClip(_root["knopf_fp"],"knopf_fp"+stations_id,level);
  47.     _root["knopf_fp"+stations_id].setSize(120,20);
  48.     _root["knopf_fp"+stations_id]._x = x_kord;
  49.     _root["knopf_fp"+stations_id]._y = y_kord;
  50.     _root["knopf_fp"+stations_id].setLabel(stat_bez);
  51.     if(dicht == "false")
  52.     {
  53.         //"onRelease" Anweisung
  54.         _root["knopf_fp"+stations_id].onRelease = function()
  55.         {
  56.             //Hier soll nun drin stehen, dass ALLE Buttons und ALLE Rechtecke gelöscht werden sollen.
  57.         }
  58.     }
  59.     x_kord2 = x_kord+180;
  60. //Hier werden weitere Buttons erstellt.
  61.     buttons_erstellen_typen(stat_bez,stations_id,x_kord2, y_kord, level, typ_1_label, typ_2_label, typ_3_label);
  62. }
  63.  
  64. //Dynamisch Buttons für die Typen I-III erstellen
  65. function buttons_erstellen_typen(stat_bez,stations_id,x_kord2, y_kord, level, typ_1_label, typ_2_label, typ_3_label)
  66. {
  67.     //Duplizieren und anpassen
  68.     duplicateMovieClip(_root["knopf_fp"],"typ"+1+"-"+stations_id,level+1);
  69.     _root["typ"+1+"-"+stations_id].setSize(120,20);
  70.     _root["typ"+1+"-"+stations_id]._x = x_kord2;
  71.     _root["typ"+1+"-"+stations_id]._y = y_kord;
  72.     _root["typ"+1+"-"+stations_id].setLabel(typ_1_label);
  73.     if(dicht == "false")
  74.     {
  75.         //"onRelease" Anweisung
  76.         _root["typ"+1+"-"+stations_id].onRelease = function()
  77.         {
  78.             trace("typ"+1+"-"+stations_id)
  79.         }
  80.     }
  81.     x_kord2 += 130;
  82.    
  83.     //Duplizieren und anpassen
  84.     duplicateMovieClip(_root["knopf_fp"],"typ"+2+"-"+stations_id,level+2);
  85.     _root["typ"+2+"-"+stations_id].setSize(120,20);
  86.     _root["typ"+2+"-"+stations_id]._x = x_kord2;
  87.     _root["typ"+2+"-"+stations_id]._y = y_kord;
  88.     _root["typ"+2+"-"+stations_id].setLabel(typ_2_label);
  89.     if(dicht == "false")
  90.     {
  91.         //"onRelease" Anweisung
  92.         _root["typ"+2+"-"+stations_id].onRelease = function()
  93.         {
  94.             trace("typ"+2+"-"+stations_id)
  95.         }
  96.     }
  97.     x_kord2 += 130;
  98.    
  99.     //Duplizieren und anpassen
  100.     duplicateMovieClip(_root["knopf_fp"],"typ"+3+"-"+stations_id,level+3);
  101.     _root["typ"+3+"-"+stations_id].setSize(120,20);
  102.     _root["typ"+3+"-"+stations_id]._x = x_kord2;
  103.     _root["typ"+3+"-"+stations_id]._y = y_kord;
  104.     _root["typ"+3+"-"+stations_id].setLabel(typ_3_label);
  105.     if(dicht == "false")
  106.     {
  107.         //"onRelease" Anweisung
  108.         _root["typ"+3+"-"+stations_id].onRelease = function()
  109.         {
  110.             trace("typ"+3+"-"+stations_id)
  111.         }
  112.     }
  113.     x_kord2 += 130;
  114. }

Die Buttons an sich funktionieren. Hab schon Traces durchlaufen lassen, die mir alle Variablen anzeigten.
Die Buttons habe ich per
ActionScript:
  1. removeMovieClip("knopf_fp");
versucht zu löschen, da dies der angehängte MC ist, der dupliziert wird.
Die Rechtecke zu löschen versuchte ich per
ActionScript:
  1. unloadMovieNum(2);

Geht halt beides nicht...

Hat jemand Rat?

Geändert von Zivi (20-01-2004 um 08:29 Uhr)
Zivi ist offline   Mit Zitat antworten
Alt 20-01-2004, 08:25   #2 (permalink)
nordlicht
 
Benutzerbild von phantura
 
Registriert seit: Apr 2002
Ort: Hamburg
Beiträge: 137
hi,
probier mal
ActionScript:
  1. knopf_pf.removeMovieClip();
vielleicht geht das...

gruss
phan
phantura ist offline   Mit Zitat antworten
Alt 20-01-2004, 08:32   #3 (permalink)
Neuer User
 
Registriert seit: Sep 2003
Ort: Bochum
Beiträge: 37
Geht nicht.

Hab gerade noch
ActionScript:
  1. _level25.removeMovieClip("knopf_fp");
  2. //oder
  3. removeMovieClip(_level25["knopf_fp"]);
und noch Sachen mit _root. probiert. Komme irgendwie nicht auf einen grünen Zweig D:
Zivi ist offline   Mit Zitat antworten
Alt 20-01-2004, 08:46   #4 (permalink)
_//\\#//\\_
 
Benutzerbild von warrantmaster
 
Registriert seit: Jan 2003
Beiträge: 7.060
speicher bei der erstellung die instanzen, die hinterher
wieder weg sollen, in ein array.
dann kannst du ganz simpel mit einer for-schleife alle
instanzen aus dem array sich selbst removen lassen.

btw,
zum löschen von gezeichnetem schau dir mal "clear" in der referenz an.

grz
warrantmaster ist offline   Mit Zitat antworten
Alt 20-01-2004, 09:53   #5 (permalink)
Neuer User
 
Registriert seit: Sep 2003
Ort: Bochum
Beiträge: 37
Hm... ich verstehe! :O
Nur bekomme ich das irgendwie trotzdem nicht hin...
ActionScript:
  1. //"onRelease" Anweisung
  2.         _root["knopf_fp"+stations_id].onRelease = function()
  3.         {
  4.             for(z=0;z<=rechteck_array_count-1;z++)
  5.             {
  6.                 trace(rechteck_array[z]);
  7.                 rechteck_array[z].clear();
  8.             }
  9.             for(i=0;i<=knopf_array_count-1;i++)
  10.             {
  11.                 trace(knopf_array[i]);
  12.                 removeMovieClip(knopf_array[i]);
  13.             }
  14.         }

Verpeil ich da irgendetwas?
Zivi ist offline   Mit Zitat antworten
Alt 20-01-2004, 14:10   #6 (permalink)
_//\\#//\\_
 
Benutzerbild von warrantmaster
 
Registriert seit: Jan 2003
Beiträge: 7.060
mal testen:

c&p in frame 1 einer leeren fla

ActionScript:
  1. var arr=[]
  2. MovieClip.prototype.paint=function()
  3. {
  4.     with(this)
  5.     {
  6.         moveTo(0,0)
  7.         lineStyle(1,0x00,100)
  8.         beginFill(0xFFCC33,100)
  9.         lineTo(50,0)
  10.         lineTo(50,50)
  11.         lineTo(0,50)
  12.         lineTo(0,0)
  13.         endFill()
  14.     }
  15. }
  16. for(var i=0;i<11;i++)
  17. {
  18.     var mc=_root.createEmptyMovieClip('mc'+i,i)
  19.     arr.push(mc)
  20.     mc._x=i*52
  21.     mc.paint()
  22.     mc1.onPress=function()
  23.     {
  24.         this.clear()
  25.     }
  26.     mc2.onPress=function()
  27.     {
  28.         kill()
  29.     }
  30. }
  31.  
  32. function kill()
  33. {
  34.     for(var i=0;i<arr.length;i++)
  35.     {
  36.         arr[i].removeMovieClip()
  37.     }
  38. }

gruß
warrantmaster ist offline   Mit Zitat antworten
Alt 21-01-2004, 08:16   #7 (permalink)
Neuer User
 
Registriert seit: Sep 2003
Ort: Bochum
Beiträge: 37
Danke, habs aber nun anders gelöst.
Die Buttons werden auf invisible = false gestellt und die farbigen Rechtecke werden von weißen überdekt.

Zwar nicht sehr elegant, aber merkt ja keiner ;>
Zivi 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 03:17 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele