Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 18-05-2005, 10:09   #1 (permalink)
Format C:\ für alle
 
Benutzerbild von El Barto
 
Registriert seit: Jan 2002
Beiträge: 226
Werde noch Irre!

Habe ein Problem,
erstelle 6 Movieclips in denen auch ein Button ist ... jetzt will ich dynamisch auch die bilder in diese MCs laden und zwar in den MC instanz "bild" die in dem MC mc+i ist. Wenn ich laden = "ordner/test.jpg" setze geht es. Muss die Bilder aber dynamisch laden. Hier mein Code:

Code:
loadVariablesNum("ip.asp", 0);
for (i=0; i<6; i++) {
	_root.mc.duplicateMovieClip("mc"+i,i);
        _root["mc"+i]._y+=i*_root.mc._height;
	_root["mc"+i]._y = _root.mc._y+(60*i);
        _root["mc"+i].wert=i
	laden = "bild" + i + "k"
	_root["mc"+i].bild.loadMovie(laden)			
        _root["mc"+i].onPress = function () {
		_global.xx = _root["mc"+ this.wert]._x;
		_global.yy = _root["mc"+ this.wert]._y;			
		startDrag (_root["mc"+ this.wert]);
        }
        _root["mc"+i].onRelease = function () {
		stopDrag ();
		if (_root["mc" + this.wert]._droptarget eq "/drop/box") {
			laden2 = _root["bild"+this.wert]
			_root.drop.box.loadMovie (laden2)
			_root["mc"+ this.wert]._x = xx;
			_root["mc"+ this.wert]._y = yy;		
			richtige++;
		
		} else {
			_root["mc"+ this.wert]._x = xx;
			_root["mc"+ this.wert]._y = yy;
				
			}
		if (_root["mc" + this.wert]._droptarget eq "/drop2/box") {
			laden2 = _root["bild"+this.wert]
			_root.drop2.box.loadMovie (laden2)			
			_root["mc"+ this.wert]._x = xx;
			_root["mc"+ this.wert]._y = yy;		
			richtige++;
		
		
		} else {
			_root["mc"+ this.wert]._x = xx;
			_root["mc"+ this.wert]._y = yy;
				
			}					
		
        }		
}
die Variablen bild1k bis bild6k sind gefüllt darum vestehe ich das nicht! Wenn ich die Sachen auf die MC ziehe lädt er mich ja auch die grossen bild1 bis bild6 Abbildungen in die anderen MCs aber die kleinen zum draggen MCs lädt er mich nicht die kleinen Abbildungen rein ... komisch.
Hat jemand eine Idee? Würde mich freuen wenn mir jemand helfen könnte.

El Barto
El Barto ist offline   Mit Zitat antworten
Alt 18-05-2005, 11:49   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
laden2 = _root["bild"+this.wert]
Wo hast du diese Variable erstellt? In laden hast du nur den Bildnamen zusammengesetzt, hier soll er aus einer Variablen erstellt werden?
  Mit Zitat antworten
Alt 18-05-2005, 11:49   #3 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
Hi!
Erweiterung vergessen???
ActionScript:
  1. laden = "bild"+i+"k.jpg";
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 18-05-2005, 11:55   #4 (permalink)
Format C:\ für alle
 
Benutzerbild von El Barto
 
Registriert seit: Jan 2002
Beiträge: 226
Nein ... bild1k wird in der ASP Seite gefüllt und an Flash übergeben.

Also ist bild1k gefüllt mit "ordner/bildname.jpg"

verstehe das nicht ... habe ich ein Zeitproblem, das die Variable da noch nicht gefüllt ist? Aber mit

Code:
loadVariablesNum("ip.asp", 0);
Hole ich mir doch alle Daten aus der ASP Seite schließlich lädt er ja auch wenn ich den MC auf den anderen droppe ... die variable "bild1" die ist ja auch mit "ordner_gross/bildname.jpg" gefüllt. Verstehe das echt nicht!

El Barto
El Barto ist offline   Mit Zitat antworten
Alt 18-05-2005, 12:23   #5 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
Hallo nochmal!
Also, wenn der loadVariables-Befehl wirklich direkt vor dem anderen Script steht, dann sind die Variablen mit Sichheit noch nicht geladen.

edit:
Kannst du ja auch testen:
ActionScript:
  1. loadVariablesNum("ip.asp", 0);
  2. onEnterFrame = function ()
  3. {trace(bild1k)}
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++

Geändert von Der Frager (18-05-2005 um 12:27 Uhr)
Der Frager ist offline   Mit Zitat antworten
Alt 18-05-2005, 12:28   #6 (permalink)
Format C:\ für alle
 
Benutzerbild von El Barto
 
Registriert seit: Jan 2002
Beiträge: 226
Aha ... und warum nicht!
El Barto ist offline   Mit Zitat antworten
Alt 18-05-2005, 12:29   #7 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
Was gibt dir denn das hier aus:
ActionScript:
  1. loadVariablesNum("ip.asp", 0);
  2. onEnterFrame = function ()
  3. {trace(bild1k)}
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 18-05-2005, 12:34   #8 (permalink)
Format C:\ für alle
 
Benutzerbild von El Barto
 
Registriert seit: Jan 2002
Beiträge: 226
Kann ich ja schlecht testen ... muss es ja online testen wegen dem ASP ... deswegen gibt er mir natürlich "undefined" aus ... aber wieso sind die variablen dann noch nicht gefüllt ... die anderen sind doch auch gefüllt?
El Barto ist offline   Mit Zitat antworten
Alt 18-05-2005, 12:43   #9 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
So, hab's bei mir mal getestet - geht!
ActionScript:
  1. loadVariablesNum("ip.asp", 0);
  2. onEnterFrame = function () {
  3.     trace(bild1k);
  4.     if (bild1k) {
  5.         delete this.onEnterFrame;
  6.         anzeigen();
  7.     }
  8. };
  9. function anzeigen() {
  10.     for (i=0; i<6; i++) {
  11.         _root.mc.duplicateMovieClip("mc"+i, i);
  12.         _root["mc"+i]._y += i*_root.mc._height;
  13.         _root["mc"+i]._y = _root.mc._y+(60*i);
  14.         _root["mc"+i].wert = i;
  15.         laden = this["bild"+i+"k"]
  16.         _root["mc"+i].bild.loadMovie(laden);
  17.         _root["mc"+i].onPress = function() {
  18.             _global.xx = _root["mc"+this.wert]._x;
  19.             _global.yy = _root["mc"+this.wert]._y;
  20.             startDrag(_root["mc"+this.wert]);
  21.         };
  22.         _root["mc"+i].onRelease = function() {
  23.             stopDrag();
  24.             if (_root["mc"+this.wert]._droptarget eq "/drop/box") {
  25.                 laden2 = _root["bild"+this.wert];
  26.                 _root.drop.box.loadMovie(laden2);
  27.                 _root["mc"+this.wert]._x = xx;
  28.                 _root["mc"+this.wert]._y = yy;
  29.                 richtige++;
  30.             } else {
  31.                 _root["mc"+this.wert]._x = xx;
  32.                 _root["mc"+this.wert]._y = yy;
  33.             }
  34.             if (_root["mc"+this.wert]._droptarget eq "/drop2/box") {
  35.                 laden2 = _root["bild"+this.wert];
  36.                 _root.drop2.box.loadMovie(laden2);
  37.                 _root["mc"+this.wert]._x = xx;
  38.                 _root["mc"+this.wert]._y = yy;
  39.                 richtige++;
  40.             } else {
  41.                 _root["mc"+this.wert]._x = xx;
  42.                 _root["mc"+this.wert]._y = yy;
  43.             }
  44.         };
  45.     }
  46. }

edit: Und zieh dir mal was über loadVars rein
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 18-05-2005, 13:00   #10 (permalink)
Format C:\ für alle
 
Benutzerbild von El Barto
 
Registriert seit: Jan 2002
Beiträge: 226
Zitat:
Besser Halbwissen als Nullwissen...
Aber danke!
So funzt es jetzt. Verstehe ich das richtig, das er jetzt so lange die Funktion durchläuft bis bild1k gefüllt ist? Glaube das AS Buch unters Kopfkissen zu stecken war doch nicht so die richtige Lernmethode. Danke Dir aber für Deine Hilfe, werde mich bessern.

El Barto
El Barto ist offline   Mit Zitat antworten
Alt 18-05-2005, 13:11   #11 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
Ja, stimmt schon so, wie du es sagst. In diesem Fall prüfst du über onEnterFrame, ob deine Variablen angekommen sind (was bei loadVars z.B. schon mit "eingebaut" ist).
Und meine Signatur habe ich - soweit ich mich erinnere - seit meinem 10. Posting oder so
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager 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 13:29 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele