Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 06-09-2003, 22:02   #1 (permalink)
Freelancer
 
Benutzerbild von komashooter
 
Registriert seit: Oct 2001
Ort: Germany - Berlin
Beiträge: 1.777
Exclamation Problem mit interner und externer Variabel

warum ist ist oldFocus und _root.oldFocus1 nicht gleich ?


Beispiel

ActionScript:
  1. _root.onEnterFrame = function() {
  2.     trace(Selection.getFocus());
  3.     oldFocus1 = Selection.getFocus();
  4. };
  5. mc.name_txt.onSetFocus = function(oldFocus) {
  6.     trace(oldFocus+" = oldFocus");
  7.     trace(_root.oldFocus1+" = oldFocus1");
  8.     if(oldFocus === _root.oldFocus1){
  9.         trace("oldFocus ist nicht true");
  10.         }
  11.     trace(this+" geklick");
  12.     trace(Selection.getFocus());
  13. };
  14. Mouse.addListener(mc.name_txt);
  15. mc.name_txt.onKillFocus = function() {
  16.     Mouse.removeListener(mc.name_txt);
  17.     trace("killed");
  18. };

ActionScript:
  1. _root.onEnterFrame = function() {
  2.     trace(Selection.getFocus());
  3.     oldFocus1 = Selection.getFocus();
  4. };
  5. mc.name_txt.onSetFocus = function(oldFocus) {
  6.     trace(oldFocus+" = oldFocus");
  7.     trace(_root.oldFocus1+" = oldFocus1");
  8.     a=oldFocus;
  9.     b=_root.oldFocus1;
  10.     if(oldFocus == _root.oldFocus1){
  11.         trace("oldFocus ist nicht true");
  12.         }
  13.     if(a == b){
  14.         trace("oldFocus ist nicht true Nr.2");
  15.         }
  16.     trace(a+" "+b);
  17.     trace(this+" geklick");
  18.     trace(Selection.getFocus());
  19. };
  20. Mouse.addListener(mc.name_txt);
  21. mc.name_txt.onKillFocus = function() {
  22.     Mouse.removeListener(mc.name_txt);
  23.     trace("killed");
  24. };






Ausgabe:

Code:
_level0.instance2
_level0.instance2 = oldFocus
_level0.instance2 = oldFocus1
_level0.instance2 _level0.instance2
_level0.mc.name_txt geklick
_level0.mc.name_txt
_level0.mc.name_txt
_level0.mc.name_txt

des funktioniert nur wenn der Focus null war

Code:
null
null
null = oldFocus
null = oldFocus1
oldFocus ist nicht true
oldFocus ist nicht true Nr.2
null null
_level0.mc.name_txt geklick
_level0.mc.name_txt
_level0.mc.name_txt
komashooter ist offline   Mit Zitat antworten
Alt 06-09-2003, 22:05   #2 (permalink)
Freelancer
 
Benutzerbild von komashooter
 
Registriert seit: Oct 2001
Ort: Germany - Berlin
Beiträge: 1.777
hier noch die FLA

zum Testen


Das Problem ist das
ActionScript:
  1. if(oldFocus == _root.oldFocus1){
  2.                 trace("oldFocus ist nicht true");
  3.         }

nicht funktioniert
Angehängte Dateien
Dateityp: zip variablen_problem_.zip (3,9 KB, 1x aufgerufen)

Geändert von komashooter (06-09-2003 um 22:16 Uhr)
komashooter ist offline   Mit Zitat antworten
Alt 06-09-2003, 22:38   #3 (permalink)
helpQLODhelp
 
Benutzerbild von bokel
 
Registriert seit: Feb 2002
Ort: Köln
Beiträge: 8.505
string != object

mfg r.
bokel ist offline   Mit Zitat antworten
Alt 06-09-2003, 22:44   #4 (permalink)
Freelancer
 
Benutzerbild von komashooter
 
Registriert seit: Oct 2001
Ort: Germany - Berlin
Beiträge: 1.777
THX Bokel

war echt schon am verzweifeln wieso es nicht geht

siehe MouseListener
komashooter ist offline   Mit Zitat antworten
Alt 06-09-2003, 22:50   #5 (permalink)
Freelancer
 
Benutzerbild von komashooter
 
Registriert seit: Oct 2001
Ort: Germany - Berlin
Beiträge: 1.777
Lightbulb Der Beweis



Code:
Output


_level0.instance2
_level0.instance2 = oldFocus
_level0.instance2 = oldFocus1
 = String Test
17 = String Test
_level0.instance2 = oldFocus
_level0.instance2 = oldFocus1
_level0.instance2 _level0.instance2
_level0.mc.name_txt geklick
_level0.mc.name_txt

ActionScript:
  1. _root.onEnterFrame = function() {
  2.     trace(Selection.getFocus());
  3.     oldFocus1 = Selection.getFocus();
  4. };
  5. mc.name_txt.onSetFocus = function(oldFocus) {
  6.     trace(oldFocus+" = oldFocus");
  7.     trace(_root.oldFocus1+" = oldFocus1");
  8.     trace(_root.oldFocus.length+" = String Test");
  9.     trace(_root.oldFocus1.length+" = String Test");
  10.     a = oldFocus;
  11.     b = _root.oldFocus1;
  12.     if (oldFocus == _root.oldFocus1) {
  13.         trace("oldFocus ist nicht true");
  14.     } else {
  15.        
  16.         trace(oldFocus+" = oldFocus");
  17.         trace(_root.oldFocus1+" = oldFocus1");
  18.         if (oldFocus == true) {
  19.             trace("oldFocus ist nicht true Nr3");
  20.         }
  21.     }
  22.     if (a._target == b._target) {
  23.         trace("oldFocus ist nicht true Nr.2");
  24.     }
  25.     trace(a+" "+b);
  26.     trace(this+" geklick");
  27.     trace(Selection.getFocus());
  28. };
  29. Mouse.addListener(mc.name_txt);
  30. mc.name_txt.onKillFocus = function() {
  31.     Mouse.removeListener(mc.name_txt);
  32.     trace("killed");
  33. };


oldFocus1 ist der String
komashooter 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:29 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele