Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 30-06-2005, 13:23   #1 (permalink)
Neuer User
 
Registriert seit: Jan 2003
Ort: united states of mars
Beiträge: 334
Probleme mit der Textfield Klasse

Hallo,

ich habe hier mal wieder ein Problem, ich erzeuge dynamisch Textfelder. Die dann mit Einträgen aus meinem array, gefüllt werden sollen. Wenn ich subhead_array[i] über trace auslese kommen auch die einträge raus. nur wenn ich das dann an this["text"+i+"_mc"]["sub"+i+"_txt"].text = subhead_array[i] übergebe und dann his["text"+i+"_mc"]["sub"+i+"_txt"].text trace ist es undefined Was mach ich hier denn falsch?


ActionScript:
  1. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  2. //-- TEXT FORMAT                      -->
  3. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  4. var discription = new TextFormat();
  5. discription.selectable = false;
  6. discription.multiline = true;
  7. discription.font = "uni 05_54";
  8. discription.color = 0xFFFFFF;
  9. discription.size = "8";
  10. var contentTxt = new TextFormat();
  11. contentTxt.selectable = false;
  12. contentTxt.multiline = true;
  13. contentTxt.font = "09_55";
  14. contentTxt.color = 0xFFFFFF;
  15. contentTxt.size = "8";
  16. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  17. //-- LOAD TEXT                                     -->
  18. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  19. var textLoaderLV = new LoadVars();
  20. textLoaderLV.onLoad = function(pSuccess) {
  21.     if (pSuccess == true) {
  22.         _root.subhead_array = new Array();
  23.         _root.subhead_array = this.txtVar.split("<br>");
  24.         trace(subhead_array.length+"LÄNG");
  25.         for (i=0; i<subhead_array.length; i++) {
  26.             var ypos = 70+(i*24);
  27.             var timeElapse = 15+i*2;
  28.             this.createEmptyMovieClip(["text"+i+"_mc"], 18500+i);
  29.             this["text"+i+"_mc"].createTextField(["sub"+i+"_txt"], 18000+i, 0, 0, 500, 30);
  30.             this["text"+i+"_mc"]["sub"+i+"_txt"].embedFonts = true;
  31.             this["text"+i+"_mc"]["sub"+i+"_txt"].text = subhead_array[i]
  32.             this["text"+i+"_mc"]["sub"+i+"_txt"].setTextFormat(contentTxt);
  33.             this["text"+i+"_mc"]._alpha = 0;
  34.             this["text"+i+"_mc"].ease("easeOutExpo", "easeOutQuad", [-500, ypos], [280, ypos], timeElapse, 0.8, 0.8, 0, 0, 0, 100);
  35.             trace( _root.subhead_array[i]);
  36.            
  37. trace(this["text"+i+"_mc"]["sub"+i+"_txt"].text);
  38.             trace(i);
  39.         }
  40.     } else {
  41.         this.text = "Fehler beim Laden!";
  42.     }
  43. };textLoaderLV.load("data/soccer.txt");
  44. stop();

Danke Guido
__________________
zum glück läuft auf meinem mac nicht alles so langsam wie der flashplayer.
______________

Geändert von stylefetish (30-06-2005 um 13:24 Uhr)
stylefetish ist offline   Mit Zitat antworten
Alt 30-06-2005, 15:41   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Versuchs mal so:
ActionScript:
  1. this.createEmptyMovieClip("text"+i+"_mc", 18500+i);
  2.                         this["text"+i+"_mc"].createTextField("sub"+i+"_txt", 18000+i, 0, 0, 500, 30);
  3.                         this["text"+i+"_mc"]["sub"+i+"_txt"].embedFonts = true;
  Mit Zitat antworten
Alt 30-06-2005, 15:53   #3 (permalink)
Neuer User
 
Registriert seit: Jan 2003
Ort: united states of mars
Beiträge: 334
Schade ich hab die Alter Version nicht mehr Ich hab das jetzt so umgebaut. Und das funktioniert. Aber vielen Dank! Für Deine Hilfe trotzdem…
Ist es schlauer die eckigen klammern grundsätzlich bein den create befehlen weg zu lassen?

Guido

ActionScript:
  1. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  2. //-- TEXT FORMAT                                -->
  3. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  4. var discription = new TextFormat();
  5. discription.selectable = false;
  6. discription.multiline = false;
  7. discription.font = "standart";
  8. discription.color = 0x000000;
  9. discription.size = "8";
  10. var contentTxt = new TextFormat();
  11. contentTxt.selectable = false;
  12. contentTxt.multiline = false;
  13. contentTxt.font = "uni 05_54";
  14. contentTxt.color = 0x000000;
  15. contentTxt.size = "8";
  16.  
  17. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  18. //-- LOAD TEXT                                     -->
  19. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  20. var textLoaderLV = new LoadVars();
  21. textLoaderLV.onLoad = function(pSuccess) {
  22.     if (pSuccess == true) {
  23.         _global.description1 = this.txtVar;
  24.         typogrid();
  25.     } else {
  26.         trace("Fehler beim Laden!");
  27.     }
  28. };
  29. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  30. //-- CREATE TYPO GRID                    -->
  31. //-- ++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  32. function typogrid() {
  33.     boolean = true;
  34.     subhead_array = new Array();
  35.     subhead_array = _global.description1.split("<br>");
  36.     trace(subhead_array.length+"LÄNG");
  37.     for (i=0; i<subhead_array.length; i++) {
  38.         var ypos = 0+((i+1)*20);
  39.         var timeElapse = 15+i*2;
  40.         this.createEmptyMovieClip(["text"+i+"_mc"], 18500+i);
  41.         this["text"+i+"_mc"].createTextField(["sub"+i+"_txt"], 18000+i, 0, 0, 200, 40);
  42.         this["text"+i+"_mc"]["sub"+i+"_txt"].embedFonts = true;
  43.         var output = subhead_array[i].toUpperCase();
  44.         this["text"+i+"_mc"]["sub"+i+"_txt"].text = output;
  45.         if (boolean == true) {
  46.             this["text"+i+"_mc"]["sub"+i+"_txt"].setTextFormat(contentTxt);
  47.             this["text"+i+"_mc"]._alpha = 0;
  48.             this["text"+i+"_mc"].ease("easeOutExpo", "easeOutQuad", [550, ypos], [280, ypos], timeElapse, 0.8, 0.8, 0, 0, 0, 100);
  49.             boolean = false;
  50.         } else {
  51.             this["text"+i+"_mc"]["sub"+i+"_txt"].setTextFormat(discription);
  52.             this["text"+i+"_mc"]._alpha = 0;
  53.             this["text"+i+"_mc"].ease("easeOutExpo", "easeOutQuad", [0, ypos-10], [280, ypos-10], timeElapse, 0.8, 0.8, 0, 0, 0, 100);
  54.             boolean = true;
  55.         }
  56.     }
  57. }
  58. textLoaderLV.load("data/soccer.txt");
  59. stop();
__________________
zum glück läuft auf meinem mac nicht alles so langsam wie der flashplayer.
______________

Geändert von stylefetish (30-06-2005 um 15:57 Uhr)
stylefetish ist offline   Mit Zitat antworten
Alt 30-06-2005, 16:15   #4 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Zitat:
Ist es schlauer die eckigen klammern grundsätzlich bein den create befehlen weg zu lassen?
Besser ist das...
  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 02:43 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele