Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 17-01-2005, 10:07   #1 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
rollOver und onPress konflikt in prototypeMC

habe ein MovieClip.prototype erstellt;

bei rollOver ändert sich textfeldfarbe, bei rollOut wieder retour;
bei onPress soll sich textfarbe ändern und bleiben, sozusagen als ACTIVE-link....

das bring ich aber irgendwie net hin
untenstehend der code:
ActionScript:
  1. MovieClip.prototype.link = function(pagename, input) {
  2.     this.MC_protolinkLine._xscale = 0;
  3.     this.MC_protolinkLine._alpha = 0;
  4.     this.T_linkname.autoSize = "center";
  5.     this.T_linkname.text = pagename;
  6.     this.T_linkname.textColor = "0x999999";
  7.     this.onRollOver = function() {
  8.         this.T_linkname.textColor = "0x993300";
  9.         this.MC_protolinkLine.onEnterFrame = function() {
  10.             this._alpha<=100 ? this._alpha += 15 : 0;
  11.             this._xscale<=100 ? this._xscale += 15 : 0;
  12.         };
  13.     };
  14.     this.onRollOut = function() {
  15.         this.T_linkname.textColor = "0x999999";
  16.         this.MC_protolinkLine.onEnterFrame = function() {
  17.             this._alpha>=0 ? this._alpha -= 15 : 0;
  18.             this._xscale>=0 ? this._xscale -= 15 : 0;
  19.         };
  20.     };
  21.     this.onPress = function() {
  22.         //_root.MC_siteHolder.unloadMovie();
  23.         _root.MC_siteHolder.loadMovie(input);
  24.         this.T_linkname.textColor = "0x993300";
  25.         /////***active link programmieren***/////
  26.         var thisButton = this;
  27.         delete thisButton._parent.lastButton.onEnterFrame;
  28.         //thisButton._parent.lastButton.MC_star._visible = false;
  29.         thisButton.T_linkname.textColor = "0x993300";
  30.         //thisButton.MC_star._visible = true;
  31.         thisButton._parent.lastButton = thisButton;
  32.     };
  33. };
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 10:59   #2 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
und was geht net?
__________________
AS3 Lernhilfen
TheFreeman ist offline   Mit Zitat antworten
Alt 17-01-2005, 12:12   #3 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
nun ja, bei rollOver ändert sich die textfarbe, bei rollOut wird die farbe wieder so wie vor rollOver, nach onPress aber wird sie auch wieder wie vor rollOver, nach onPress soll sie aber eine andere farbe behalten, quasi als hervorgehoben im vergleich zu den anderen links......
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 12:37   #4 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
Das ist doch logisch.

Wenn du auf die Schaltfläche geklickt hast, musst du logischerweise auch irgendwann wieder von dieser Schaltfläche herunterrollen. Und da kommt dann die rollOut-Methode zum greifen.
Also musst Du bei onPress eine Variable setzen (z.B. gedrueckt = true) und diese dann in rollOut abfragen (z.B. if(!gedrueckt){hier deine bisherigen Befehle rein} ). Dann müsste es gehn.
__________________
AS3 Lernhilfen
TheFreeman ist offline   Mit Zitat antworten
Alt 17-01-2005, 13:11   #5 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
ActionScript:
  1. this.onRollOver = function() {
  2.         this.T_linkname.textColor = "0x993300";
  3.         this.MC_protolinkLine.onEnterFrame = function() {
  4.             this._alpha<=100 ? this._alpha += 15 : 0;
  5.             this._xscale<=100 ? this._xscale += 15 : 0;
  6.         };
  7.     };
  8.     this.onRollOut = function() {
  9.         if (!pressed) {
  10.             this.T_linkname.textColor = "0x999999";
  11.             this.MC_protolinkLine.onEnterFrame = function() {
  12.                 this._alpha>=0 ? this._alpha -= 15 : 0;
  13.                 this._xscale>=0 ? this._xscale -= 15 : 0;
  14.             };
  15.         }
  16.     };
  17.     this.onPress = function() {
  18.         _root.MC_siteHolder.unloadMovie();
  19.         _root.MC_siteHolder._x = siteHolderX;
  20.         _root.MC_siteHolder.loadMovie(input);
  21.         this.T_linkname.textColor = "0x993300";
  22.         /////***active link programmieren***/////
  23.         var pressed;
  24.         pressed = true;
  25.     };

so funzt des aber net...?
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 13:52   #6 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
Also bei mir funzt das so:

ActionScript:
  1. MovieClip.prototype.link = function(pagename, input) {
  2.     this.MC_protolinkLine._xscale = 0;
  3.     this.MC_protolinkLine._alpha = 0;
  4.     this.T_linkname.autoSize = "center";
  5.     this.T_linkname.text = pagename;
  6.     this.T_linkname.textColor = "0x999999";
  7.     this.onRollOver = function() {
  8.         this.T_linkname.textColor = "0x993300";
  9.         this.MC_protolinkLine.onEnterFrame = function() {
  10.             this._alpha<=100 ? this._alpha += 15 : 0;
  11.             this._xscale<=100 ? this._xscale += 15 : 0;
  12.         };
  13.     };
  14.     this.onRollOut = function() {
  15.         if (!pressed) {
  16.             this.T_linkname.textColor = "0x999999";
  17.             this.MC_protolinkLine.onEnterFrame = function() {
  18.                 this._alpha>=0 ? this._alpha -= 15 : 0;
  19.                 this._xscale>=0 ? this._xscale -= 15 : 0;
  20.             };
  21.         }
  22.     };
  23.     this.onPress = function() {
  24.         _root.MC_siteHolder.unloadMovie();
  25.         _root.MC_siteHolder._x = siteHolderX;
  26.         _root.MC_siteHolder.loadMovie(input);
  27.         this.T_linkname.textColor = "0x993300";
  28.         /////***active link programmieren***/////
  29.         this.pressed = true;
  30.     };
  31.  };
  32.  button1.link("testlink","pageurl");

Geht wunderbar
Angehängte Dateien
Dateityp: zip Farbwechsel.zip (2,6 KB, 13x aufgerufen)
__________________
AS3 Lernhilfen

Geändert von TheFreeman (17-01-2005 um 13:55 Uhr)
TheFreeman ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:11   #7 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
anscheinend habe ich was falsch erklärt, du was falsch verstanden oder ich habe tomaten auf den augis.....

auch bei deiner zum download verfügbar gestellten datei ist

NACH KLICK AUF DEN LINK UND ANSCHLIESSENDEM ROLLOUT DIE FARBE WIEDER GRAU UND NICHT WEINROT...........(das soll nicht als schreien wirken, möcht nur auf das problem hinweisen )

die schrift soll aber weinrot bleiben...........
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:13   #8 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
tut es bei mir auch !!!!!!!! (auch kein schreien)
__________________
AS3 Lernhilfen
TheFreeman ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:19   #9 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
ähhhhhhhhh

ich klicke mit der linken maustaste auf deinen mc

gehe raus aus dem mc

und der mc zeigt aber die schrift grau an und nicht weinrot......

ist das bei dir auch so?
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:22   #10 (permalink)
Gedankengestalter
 
Benutzerbild von TheFreeman
 
Registriert seit: May 2002
Ort: Bayern
Beiträge: 486
Nein, bei mir ist das genau so, wie Du das wolltest.
__________________
AS3 Lernhilfen
TheFreeman ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:23   #11 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
also stellt mein pc es falsch dar?

gibts das?
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:30   #12 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
mach mal des "ausrufe-zeichen aus der if "if (pressed) {" <-- so
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:50   #13 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
sodala:

anbei die fla

ich bin am ende mit meinem flash-latein..........
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:54   #14 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
ok, selber draufgekommen:

ich habe nur
ActionScript:
  1. var pressed
definiert;

sollte aber
ActionScript:
  1. this.pressed
heißen.............
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 17-01-2005, 14:58   #15 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Scheinbar hängt mir mein nRausch vom Samstag noch im Rücken!!
Des oben war Müll!
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake 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 03:28 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele