Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 08-04-2004, 22:37   #1 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Pfade! Ich raff's nicht...

Hallo,

ich raff's nicht. Wo ist da der Wurm drin? Ich hab versucht mein Script so umzuschreiben, dass die .swf-Datei auch extern eingeladen funktioniert!

Wäre echt nett, wenn sich das mal wer ansieht
Danke!

ActionScript:
  1. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  2. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  3.  
  4. // --------------- Navitagtionstexte bauen -------------- //
  5. for(i=0; i<navArr.length; i++) {
  6.     // Button-MCs erstellen -----------------------------------------------------
  7.     this.createEmptyMovieClip(this[navArr[i][1] add "_mc"], i*199+5)// DerMcName_mc
  8.     with(this[navArr[i][1] add "_mc"]) {
  9.         _y = 682;
  10.         createTextField(this[navArr[i][1] add "_txt"], i*13, i*150+75, 0, 500, 19)// DerTxtName_txt
  11.     }
  12.     // Button-Txts erstellen ----------------------------------------------------
  13.     with(this[navArr[i][1] add "_mc"][navArr[i][1] + "_txt"]) {
  14.         text = this.navArr[i][0];
  15.         selectable = false;
  16.         autoSize = true;
  17.         embedFonts = true;
  18.         setTextFormat(formatNormal);
  19.     }
  20.     // Content-MCs erstellen ----------------------------------------------------
  21.     this.createEmptyMovieClip(this[navArr[i][1] add "Cont"], i*456+3);
  22.     this[navArr[i][1] add "Cont"].attachMovie(this.navArr[i][1], this[nav[i][1] add "_mc"], i*4567+3);
  23.     with(this[navArr[i][1] add "Cont"]) {
  24.         _x = 40;
  25.         _y = -430;
  26.     }
  27.    
  28. };
__________________
Mediendesign-Student

Geändert von johanness (08-04-2004 um 22:38 Uhr)
johanness ist offline   Mit Zitat antworten
Alt 08-04-2004, 22:40   #2 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
was macht er den genau nicht ?
__________________
TVNEXT Solutions
atothek ist offline   Mit Zitat antworten
Alt 08-04-2004, 23:02   #3 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Die 'with'-Aktionen schlagen immer fehl heißt es...
=> D.h. irgendwie sind so ziehmilch alle Pfade falsch
__________________
Mediendesign-Student
johanness ist offline   Mit Zitat antworten
Alt 08-04-2004, 23:10   #4 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
Na die sache mit with ist ehrlich gesagt auch keine gute angewohnheit es ist zwar etwas mehr tipparbeit aber es ist definitiv zuverlässig ich würde mich echt davon verabschieden da es auch keine saubere instazierung ist
__________________
TVNEXT Solutions
atothek ist offline   Mit Zitat antworten
Alt 08-04-2004, 23:12   #5 (permalink)
Neuer User
 
Registriert seit: Mar 2002
Ort: D'dorf
Beiträge: 765
hi johanness,

aber du willst nicht ernsthaft behaupten, dass die swf für sich alleine funktioniert, oder?
ActionScript:
  1. this[navArr[i][1] add "_mc"]
...kann nicht funktionieren.
Gib mir ein paar Minuten...
Ich schau mal drüber

...ich mag with nicht...

gruß,
roman
romän ist offline   Mit Zitat antworten
Alt 08-04-2004, 23:14   #6 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
ich habs gefunden die with aktionen schlagen fehl weil du beim erzeugen de mc als instanznamen eine eavaluierten string angibst und das raft flash nicht ist auch klar da er davon ausgeht das es eine referenz ist und kein string

Hier ne version die looft

ActionScript:
  1. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  2. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  3. // --------------- Navitagtionstexte bauen -------------- //
  4. for (i=0; i<navArr.length; i++) {
  5.     // Button-MCs erstellen -----------------------------------------------------
  6.     this.createEmptyMovieClip(navArr[i][1] add "_mc", i*199+5);
  7.     // DerMcName_mc
  8.     with (this[navArr[i][1] add "_mc"]) {
  9.         _y = 682;
  10.         createTextField(navArr[i][1] add "_txt", i*13, i*150+75, 0, 500, 19);
  11.         // DerTxtName_txt
  12.     }
  13.     // Button-Txts erstellen ----------------------------------------------------
  14.     with (this[navArr[i][1] add "_mc"][navArr[i][1]+"_txt"]) {
  15.         text = this.navArr[i][0];
  16.         selectable = false;
  17.         autoSize = true;
  18.         embedFonts = true;
  19.         setTextFormat(formatNormal);
  20.     }
  21.     // Content-MCs erstellen ----------------------------------------------------
  22.     this.createEmptyMovieClip(navArr[i][1] add "Cont", i*456+3);
  23.     this[navArr[i][1] add "Cont"].attachMovie(this.navArr[i][1], this[nav[i][1] add "_mc"], i*4567+3);
  24.     with (this[navArr[i][1] add "Cont"]) {
  25.         _x = 40;
  26.         _y = -430;
  27.     }
  28. }

noch ein kleiner tipp folgt gleich
__________________
TVNEXT Solutions
atothek ist offline   Mit Zitat antworten
Alt 08-04-2004, 23:20   #7 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
@romän ja das with ist auch nicht mein freund

so nun eine etwas lesbare schreibweise (nix gegen deinen Stil)

ActionScript:
  1. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  2. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  3. // --------------- Navitagtionstexte bauen -------------- //
  4. for (i=0; i<navArr.length; i++) {
  5.     //
  6.     var aktClipName = navArr[i][1] add "_mc";
  7.     var aktTxtName = navArr[i][1] add "_txt";
  8.     var aktContName = navArr[i][1] add "Cont";
  9.     // Button-MCs erstellen -----------------------------------------------------
  10.     this.createEmptyMovieClip(aktClipName, i*199+5);
  11.     // DerMcName_mc
  12.     with (this[aktName]) {
  13.         _y = 682;
  14.         createTextField(aktTxtName, i*13, i*150+75, 0, 500, 19);
  15.         // DerTxtName_txt
  16.     }
  17.     // Button-Txts erstellen ----------------------------------------------------
  18.     with (this[aktName][aktTxtName]) {
  19.         text = this.navArr[i][0];
  20.         selectable = false;
  21.         autoSize = true;
  22.         embedFonts = true;
  23.         setTextFormat(formatNormal);
  24.     }
  25.     // Content-MCs erstellen ----------------------------------------------------
  26.     this.createEmptyMovieClip(aktContName, i*456+3);
  27.     this[aktContName].attachMovie(this.navArr[i][1], aktClipName, i*4567+3);
  28.     with (this[aktContName]) {
  29.         _x = 40;
  30.         _y = -430;
  31.     }
  32. }
__________________
TVNEXT Solutions

Geändert von atothek (08-04-2004 um 23:23 Uhr)
atothek ist offline   Mit Zitat antworten
Alt 08-04-2004, 23:22   #8 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
last but not least

ActionScript:
  1. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  2. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  3. // --------------- Navitagtionstexte bauen -------------- //
  4. for (i=0; i<navArr.length; i++) {
  5.         //
  6.         var aktClipName = navArr[i][1] add "_mc";
  7.         var aktTxtName = navArr[i][1] add "_txt";
  8.         var aktContName = navArr[i][1] add "Cont";
  9.         // Button-MCs erstellen -----------------------------------------------------
  10.         this.createEmptyMovieClip(aktClipName, i*199+5);
  11.         // DerMcName_mc
  12.    
  13.         this[aktClipName]._y = 682;
  14.         this[aktClipName].createTextField(aktTxtName, i*13, i*150+75, 0, 500, 19);
  15.         // Button-Txts erstellen ----------------------------------------------------
  16.         this[aktClipName][aktTxtName].text = this.navArr[i][0];
  17.         this[aktClipName][aktTxtName].selectable = false;
  18.         this[aktClipName][aktTxtName].autoSize = true;
  19.         this[aktaktClipNameName][aktTxtName].embedFonts = true;
  20.         // Content-MCs erstellen ----------------------------------------------------
  21.         this.createEmptyMovieClip(aktContName, i*456+3);
  22.         this[aktContName].attachMovie(this.navArr[i][1], aktClipName, i*4567+3);
  23.         this[aktContName]._x = 40;
  24.         this[aktContName]._y = -430;
  25. }
__________________
TVNEXT Solutions

Geändert von atothek (09-04-2004 um 09:16 Uhr)
atothek ist offline   Mit Zitat antworten
Alt 09-04-2004, 08:56   #9 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Ja, doch! Sieht eindeutig besser aus.
Aber es geht trotzdem nicht Irgendwo is da noch derwurm drinne... Eigentlich sollte das doch laufen, wenn mans einfach einfügt!?

Könntet ihr euch das nochmal ansehen? DANKE





Hier nochmal die Tiefenangaben verbessert:
ActionScript:
  1. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  2. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  3. // --------------- Navitagtionstexte bauen -------------- //
  4. for (i=0; i<navArr.length; i++) {
  5.         //
  6.         var aktClipName = navArr[i][1] add "_mc";
  7.         var aktTxtName = navArr[i][1] add "_txt";
  8.         var aktContName = navArr[i][1] add "Cont";
  9.         // Button-MCs erstellen -----------------------------------------------------
  10.         this.createEmptyMovieClip(aktClipName, _global.tiefe++);
  11.         // DerMcName_mc
  12.         this[aktName]._y = 682;
  13.         this[aktName].createTextField(aktTxtName, _global.tiefe++, i*150+75, 0, 500, 19);
  14.         // Button-Txts erstellen ----------------------------------------------------
  15.         this[aktName][aktTxtName].text = this.navArr[i][0];
  16.         this[aktName][aktTxtName].selectable = false;
  17.         this[aktName][aktTxtName].autoSize = true;
  18.         this[aktName][aktTxtName].embedFonts = true;
  19.         // Content-MCs erstellen ----------------------------------------------------
  20.         this.createEmptyMovieClip(aktContName, _global.tiefe++);
  21.         this[aktContName].attachMovie(this.navArr[i][1], aktClipName, _global.tiefe++);
  22.         this[aktContName]._x = 40;
  23.         this[aktContName]._y = -430;
  24. }
__________________
Mediendesign-Student

Geändert von johanness (09-04-2004 um 09:18 Uhr)
johanness ist offline   Mit Zitat antworten
Alt 09-04-2004, 09:09   #10 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
guten Morgen bei mir macht er es auch wenn du dir beim testen mal die variablen auflisten lässt(strg+alt+v) dann siehste das alle sachen vorhanden sind was vielleicht nicht looft ist der attach ?
__________________
TVNEXT Solutions
atothek ist offline   Mit Zitat antworten
Alt 09-04-2004, 09:13   #11 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
Asche auf mein haupt ich hatte ne Änderung gemacht und zwar bei aktName --> aktClipName und das hatte ich im script nicht durchgeändert ich habs im letzten thread korrigiert
__________________
TVNEXT Solutions
atothek ist offline   Mit Zitat antworten
Alt 09-04-2004, 09:19   #12 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Das hatte ich vor net Stunde auch schon mal geändert. aber das hilft irgendwie nichts... aber es muss eigentlihc schon so sein!

Dann wäre es so, aber es geht auch nicht!
ActionScript:
  1. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  2. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  3. // --------------- Navitagtionstexte bauen -------------- //
  4. for (i=0; i<navArr.length; i++) {
  5.         //
  6.         var aktClipName = navArr[i][1] add "_mc";
  7.         var aktTxtName = navArr[i][1] add "_txt";
  8.         var aktContName = navArr[i][1] add "Cont";
  9.         // Button-MCs erstellen -----------------------------------------------------
  10.         this.createEmptyMovieClip(aktClipName, _global.tiefe++);
  11.         // DerMcName_mc
  12.         this[aktClipName]._y = 682;
  13.         this[aktClipName].createTextField(aktTxtName, _global.tiefe++, i*150+75, 0, 500, 19);
  14.         // Button-Txts erstellen ----------------------------------------------------
  15.         this[aktClipName][aktTxtName].text = this.navArr[i][0];
  16.         this[aktClipName][aktTxtName].selectable = false;
  17.         this[aktClipName][aktTxtName].autoSize = true;
  18.         this[aktClipName][aktTxtName].embedFonts = true;
  19.         // Content-MCs erstellen ----------------------------------------------------
  20.         this.createEmptyMovieClip(aktContName, _global.tiefe++);
  21.         this[aktContName].attachMovie(this.navArr[i][1], aktClipName, _global.tiefe++);
  22.         this[aktContName]._x = 40;
  23.         this[aktContName]._y = -430;
  24. }
__________________
Mediendesign-Student
johanness ist offline   Mit Zitat antworten
Alt 09-04-2004, 09:25   #13 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Aarg, zum Haare ausreißen ist das!
Diese Zeile fehlt:
ActionScript:
  1. this[aktClipName][aktTxtName].setTextFormat(formatNormal);

Es geht jetzt alles und die Buttons werden ordnungsgemäß erstellt.




Nochmal vielen Dank für eueren Einsatz
__________________
Mediendesign-Student
johanness ist offline   Mit Zitat antworten
Alt 09-04-2004, 09:26   #14 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
so ich hab ne Modifikation vorgenommen zum test hier mal das ganze script in eine leere fla erstes bild und test looft einwandfrei

ActionScript:
  1. this.square = function(pMc, pThick, pColor, pFillColor, pWidth, pHeight) {
  2.     //
  3.     trace(pMc);
  4.     pMc.lineStyle(pThick, pColor, 100);
  5.     pMc.beginFill(pFillColor, 100);
  6.     pMc.lineTo(pWidth, 0);
  7.     pMc.lineTo(pWidth, pHeight);
  8.     pMc.lineTo(0, pHeight);
  9.     pMc.lineTo(0, 0);
  10.     pMc.endFill();
  11. };
  12. // Array = [[Btn-Text, Btn-Name/Verknüpfung-Name], ...];
  13. navArr = [["Contact", "contact"], ["Photography", "gallery"], ["Portfolio", "portfolio"]];
  14. // --------------- Navitagtionstexte bauen -------------- //
  15. for (i=0; i<navArr.length; i++) {
  16.     //
  17.     var aktClipName = navArr[i][1] add "_mc";
  18.     var aktTxtName = navArr[i][1] add "_txt";
  19.     var aktContName = navArr[i][1] add "Cont";
  20.     // Button-MCs erstellen -----------------------------------------------------
  21.     this.createEmptyMovieClip(aktClipName, i*199+5);
  22.     // DerMcName_mc
  23.     this.square(this[aktClipName], 1, 0x000000, 0x226699, 100, 100);
  24.     this[aktClipName]._y = (this[aktClipName]._width+2)*i;
  25.     this[aktClipName].createTextField(aktTxtName, i*13, i*150+75, 0, 500, 19);
  26.     // Button-Txts erstellen ----------------------------------------------------
  27.     this[aktClipName][aktTxtName].text = this.navArr[i][0];
  28.     this[aktClipName][aktTxtName].selectable = false;
  29.     this[aktClipName][aktTxtName].autoSize = true;
  30.     this[aktClipName][aktTxtName].embedFonts = true;
  31. this[aktClipName][aktTxtName].setTextFormat(formatNormal);
  32.     // Content-MCs erstellen ----------------------------------------------------
  33.     this.createEmptyMovieClip(aktContName, i*456+3);
  34.     this[aktContName].attachMovie(this.navArr[i][1], aktClipName, i*4567+3);
  35.     this[aktContName]._x = 40;
  36.     this[aktContName]._y = -430;
  37. }
__________________
TVNEXT Solutions

Geändert von atothek (09-04-2004 um 09:28 Uhr)
atothek ist offline   Mit Zitat antworten
Alt 09-04-2004, 09:28   #15 (permalink)
Flashaholic
 
Benutzerbild von atothek
 
Registriert seit: Feb 2003
Ort: Berlin
Beiträge: 1.459
na das ist ärgerlich wenn eine zeile fehlt

sorry ist mir wohl rausgerutscht
__________________
TVNEXT Solutions

Geändert von atothek (09-04-2004 um 09:32 Uhr)
atothek 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 00:40 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele