[ascoders] Re: Funktionsaufruf??

  • From: Peter.Geller@xxxxxxxx
  • To: ascoders@xxxxxxxxxxxxx
  • Date: Tue, 15 Oct 2002 14:16:35 +0200

Hi Volker,
was ist eigentlich hier der Unterschied zu Deiner prototype methode ???
So funktioniert das nämlich auch!

Danke
Peter

this.createTextField("textfeld",1,100,100,100,100);
text = "Wer hat an der Uhr gedreht, ist es wirklich schon so spät?
\rZeilenumbruch"
textfeld.text = text;
textfeld.autoSize = true;

format = function (){
      format = new TextFormat();
      format.font = "Arial"
      format.size = 10
      format.color = 0xff0000;
      format.align = "left";
      format.bold = "false";
      format.italic = "false";
      format.underline = false;
      format.url = null;
      format.target = null;
      format.indent = null;
      format.leading = null;
      this.setTextFormat(format);
}
textfeld.test = format;
textfeld.test();



                                                                                
                                                     
                      volker kreß                                               
                                                     
                      <kress@xxxxxxxxxx>        To:       
ascoders@xxxxxxxxxxxxx                                                     
                      Sent by:                  cc:                             
                                                     
                      ascoders-bounce@fr        Subject:  [ascoders] Re: 
Funktionsaufruf??                                           
                      eelists.org                                               
                                                     
                                                                                
                                                     
                                                                                
                                                     
                      15.10.2002 12:34                                          
                                                     
                      Please respond to                                         
                                                     
                      ascoders                                                  
                                                     
                                                                                
                                                     
                                                                                
                                                     




Hallo Peter,

versuch mal ein trace und du wirst sehn das this == _level0 und nicht
wie von dir erwartet textfeld ist, was auch extrem logisch ist!
möchtest du einen Bezug auf dein Textfeld erzeugen musst du format als
Methode von textfeld aufrufen,  z.B. über TextField.prototype.format =
_level0.format;
--> dein Code sieht dann wie folgt aus:

this.createTextField("textfeld",1,0,50,100,100);
text = "Wer hat an der Uhr gedreht, ist es wirklich schon so spät?"
this.textfeld.text = text;
this.textfeld.autoSize = "left";



TextField.prototype.format = function (){
             trace ("-->" + this)// "-->_level0.textfeld"
       textformat = new TextFormat();
       textformat.font = "Arial"
       textformat.size = 10
       textformat.color = 0xff0000;
       textformat.align = "left";
       textformat.bold = "false";
       textformat.italic = "false";
       textformat.underline = false;
       textformat.url = null;
       textformat.target = null;
       textformat.indent = null;
       textformat.leading = null;
       this.setTextFormat(textformat);
     }

textfeld.format();
stop();



volker

this.createTextField("textfeld",1,0,50,100,100);
text = "Wer hat an der Uhr gedreht, ist es wirklich schon so spät?"
this.textfeld.text = text;
this.textfeld.autoSize = "left";
function format(name){
             ----->trace(this)
       textformat = new TextFormat();
       textformat.font = "Arial"
       textformat.size = 10
       textformat.color = 0xff0000;
       textformat.align = "left";
       textformat.bold = "false";
       textformat.italic = "false";
       textformat.underline = false;
       textformat.url = null;
       textformat.target = null;
       textformat.indent = null;
       textformat.leading = null;
       name.setTextFormat(textformat);
       // wieso kann ich nicht this. anstatt name benutzen
}

textfeld = format(textfeld);
Am Dienstag den, 15. Oktober 2002, um 12:17, schrieb
Peter.Geller@xxxxxxxx:

> Hallo,
> kann mir jemand sagen wieso ich bei dem Funktionsaufruf bezogen auf das
> Textfeld
> innerhalb der Funktion format bei name.setTextFormat(textformat) nicht
> this.setTextFormat(textformat)
> benutzen kann ??
>
>
> this.createTextField("textfeld",1,0,50,100,100);
> text = "Wer hat an der Uhr gedreht, ist es wirklich schon so spät?"
> this.textfeld.text = text;
> this.textfeld.autoSize = "left";
> function format(name){
>       textformat = new TextFormat();
>       textformat.font = "Arial"
>       textformat.size = 10
>       textformat.color = 0xff0000;
>       textformat.align = "left";
>       textformat.bold = "false";
>       textformat.italic = "false";
>       textformat.underline = false;
>       textformat.url = null;
>       textformat.target = null;
>       textformat.indent = null;
>       textformat.leading = null;
>       name.setTextFormat(textformat);
>       // wieso kann ich nicht this. anstatt name benutzen
> }
>
> textfeld = format(textfeld);
>
> PS: momentan komme ich mir vor, als hätte ich erst vor kurzem angefangen
> mit Actionscript zu programmieren :-(
>
> Danke
>
> Peter
>
> ------------------------------------------------------
> Archiv   : //www.freelists.org/archives/ascoders/
> Optionen : //www.freelists.org/list/ascoders
> ------------------------------------------------------
>
>
_I       _I   _I_I_I_I   _I_I_I_I   _I_I_I_I   _I_I_I_I   _I_I_I_I
_I_I_I_I
_I       _I   _I             _I             _I             _I       _I
_I      _I   _I       _I
_I       _I   _I_I_I_I    _I             _I            _I_I_I_I
_I_I_I_I   _I       _I
_I       _I              _I   _I             _I
_I             _I             _I       _I
_I_I_I_I     _I_I_I_I  _I             _I_I_I_I   _I_I_I_I  _I_I_I_I
_I       _I
/*webdedesigns




------------------------------------------------------
Archiv   : //www.freelists.org/archives/ascoders/
Optionen : //www.freelists.org/list/ascoders
------------------------------------------------------

Other related posts: