Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 09-10-2006, 19:06   #1 (permalink)
Neuer User
 
Benutzerbild von tecone
 
Registriert seit: Nov 2003
Beiträge: 110
dynamsich erzeugte funktionen + variablen

tach,

folgendes problem:
dieser code tut seinen dienst
PHP-Code:
this.exploreItem1_btn.onSetFocus = function() {
exploreItem1Selected true;
};
this.exploreItem1_btn.onKillFocus = function() {
exploreItem1Selected false;
};
//
this.exploreItem2_btn.onSetFocus = function() {
exploreItem2Selected true;
};
this.exploreItem2_btn.onKillFocus = function() {
exploreItem2Selected false;
};
//
this.exploreItem3_btn.onSetFocus = function() {
exploreItem3Selected true;
};
this.exploreItem3_btn.onKillFocus = function() {
exploreItem3Selected false;
}; 
da ich aber am ende ca. 30 von den funktionen schreiben müsste, wollte
ich die dinger in einer for-schleife dynamisch erzeugen ...
nur leider funzt die ******** ned
wieso ?
PHP-Code:
for (i=1i<4i++) {
    
this["exploreItem"+i+"_btn"].onSetFocus = function() {
        
this["exploreItem"+i+"Selected"] = true;
    };
    
this["exploreItem"+i+"_btn"].onKillFocus = function() {
        
this["exploreItem"+i+"Selected"] = false;
    };

thx schonmal für eure mühe
tecone ist offline   Mit Zitat antworten
Alt 09-10-2006, 19:10   #2 (permalink)
Der Wunderhund
 
Benutzerbild von gaspode
 
Registriert seit: Jun 2002
Ort: Hattingen
Beiträge: 10.515
Hi.

Du brauchst ne ID.

PHP-Code:
for (i=1i<4i++) {
    
this["exploreItem"+i+"_btn"].ID i;
    
this["exploreItem"+i+"_btn"].onSetFocus = function() { 
        
this["exploreItem"+this.ID+"Selected"] = true
    }; 
    
this["exploreItem"+i+"_btn"].onKillFocus = function() { 
        
this["exploreItem"+this.ID+"Selected"] = false
    }; 

gruß, gaspode
gaspode ist offline   Mit Zitat antworten
Alt 10-10-2006, 09:16   #3 (permalink)
Neuer User
 
Benutzerbild von tecone
 
Registriert seit: Nov 2003
Beiträge: 110
ok. habs grad eben mal probiert. leider ohne erfolg.
hab auch versucht die variable ID vorher zu definieren...
tecone ist offline   Mit Zitat antworten
Alt 10-10-2006, 12:45   #4 (permalink)
Der Wunderhund
 
Benutzerbild von gaspode
 
Registriert seit: Jun 2002
Ort: Hattingen
Beiträge: 10.515
>this["exploreItem"+this.ID+"Selected"] = true;

Hmm, könnte am vorderen »this« liegen. Wo soll
sich denn die Variable »exploreItem1Selected« be-
finden? Im root? Dann probiers mal mit:

_root["exploreItem"+this.ID+"Selected"] = true;

gruß, gaspode
gaspode 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 06:13 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele