Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 11-11-2003, 01:20   #1 (permalink)
Neuer User
 
Registriert seit: Nov 2001
Beiträge: 17
for-schleife / zugriff auf arrayelemente ...

hi,

folgendes problem:

ich habe als erstes eine funktion die von buttons aufgerufen wird!
// function for turnHandy-buttons
function turnIt(para, who){
turn_mc.gotoAndPlay(para);
who.useHandCursor = 0;
}
// create array which holds turnHandy-buttons names and according turn_mc-labels!
turnHandy = [[null_btn,"six"],[one_btn,"two"],[two_btn,"three"],[three_btn,"four"],[four_btn,"five"],[five_btn,"six"]];

for(i=0; i<turnHandy.length; i++){
turnHandy[i][0].onRollOver = function(){
turnIt(turnHandy[i][1], this);
}
}

das problem liegt in der for-schleife - es werden die buttons zwar erzeugt und die beiden parameter auch an die funktion turnIt(para, who); übergeben, aber nur 'this' kommt dort auch wie gewünscht an!!
'turnHandy[i][1]' aber nicht!!!

wenn ich das hardcode:
for(i=0; i<turnHandy.length; i++){
turnHandy[i][0].onRollOver = function(){
//----------------------------------
turnIt(turnHandy[3][1], this);
//----------------------------------
}
}

...wird auch der erste paramter richtig übergeben!

frage: wie kann ich die laufvariable 'i' an die onRollOver-function übergeben???

ich hab einiges ausprobiert aber es klappt einfach nicht - vielen dank für eure hilfe

martin



www.martink65.com
martink65 ist offline   Mit Zitat antworten
Alt 11-11-2003, 06:44   #2 (permalink)
HAY
Neuer User
 
Benutzerbild von HAY
 
Registriert seit: Aug 2002
Ort: Faust-Stadt
Beiträge: 2.577
hi
speichere dein i einfach in den button als id.
ActionScript:
  1. for (i=0; i<turnHandy.length; i++) {
  2.         turnHandy[i][0].id=i
  3.         turnHandy[i][0].onRollOver = function() {
  4.         turnIt(turnHandy[this.id][1], this);
  5.         };
  6. }
__________________
gruß Harry
HAY ist offline   Mit Zitat antworten
Alt 11-11-2003, 10:49   #3 (permalink)
Neuer User
 
Registriert seit: Nov 2001
Beiträge: 17
na klar - ich depp

vielen herzlichen dank harry
martink65 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 04:17 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele