Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 06-05-2005, 14:00   #1 (permalink)
"E"
fragonautin
 
Benutzerbild von "E"
 
Registriert seit: Aug 2001
Ort: Bremen
Beiträge: 174
erzeugten Clip ansprechen bei rollOver alpha aus. : )

Huhu!
Ich hänge gerade irgendwie.

Ich habe ein paar Flächen erzeugt,
ActionScript:
  1. MovieClip.prototype.flaeche = function() {
  2.         createEmptyMovieClip("bg_main",100);
  3.         for(i=0; i<6; i++) {
  4.             duplicateMovieClip("bg_main", "bg_main"+i, i+200);
  5.             x =_root["bg_main"+i]._x=i*117;
  6. }
  7. }
  8. flaeche();

Und dann noch eine alpha-ausfaden-Funktion

ActionScript:
  1. MovieClip.prototype.alphaaus = function() {
  2.     this.onEnterFrame = function() {
  3.         this._alpha -= 5;
  4.         if (this._alpha<2) {
  5.             this._alpha = 0;
  6.         }
  7.     };
  8. };

Und jetzt will ich, dass bei RollOver auf so einen bg_main[i]-Clip das Ding unsichbar wird, ich habe es schon versucht mit


ActionScript:
  1. MovieClip.prototype.flaeche = function() {
  2.         createEmptyMovieClip("bg_main",100);
  3.         for(i=0; i<6; i++) {
  4.             duplicateMovieClip("bg_main", "bg_main"+i, i+200);
  5.             x =_root["bg_main"+i]._x=i*117;
  6. _root["bg_main"+i].onRollOver = function() {
  7. alphaaus();}
  8.  
  9. }
  10. }
  11. flaeche();

Aber irgendwie funzt das nicht, wo ist denn mein Denkfehler?

LG
"E"
__________________
„Niemand versteht die Ledermäuse.“

Die Ledermäuse
"E" ist offline   Mit Zitat antworten
Alt 06-05-2005, 14:13   #2 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
So:
ActionScript:
  1. _root["bg_main"+i].onRollOver = function() {
  2. this.alphaaus();
  3. }
Sonst wird die Haupt-Timeline selbst komplett ausgefadet...

Übrigens verwendet man _so_ definitv keine prototypes...
__________________
RTFM
Wie man Fragen richtig stellt.

Achim Bindannmalweg

Money makes the world go round, fear makes it turn much faster.
(New Model Army)
sonar ist offline   Mit Zitat antworten
Alt 06-05-2005, 14:34   #3 (permalink)
"E"
fragonautin
 
Benutzerbild von "E"
 
Registriert seit: Aug 2001
Ort: Bremen
Beiträge: 174
*g* keine Ahnung was prototypes überhaupt sind, hab das da einfach mal hingeschrieben ...

Nee, also irgendwie geht das nicht, deinen Vorschlag hatte ich auch schon ausprobiert ...

Vielleicht bringt es mehr, wenn ich das GANZE Script zeige ...

ActionScript:
  1. main = new Array;
  2. farben = new Array;
  3. main = ["Home", "Initiative", "Wasserbedarf", "Brunnen", "Mein Beitrag", "News & Presse"]
  4. farben = ["0x063461", "0x21507F","0x39648D","0x52789C", "0x6B89AA","0x839DB7","0x569BC2"]
  5.  
  6. mainmenu = new TextFormat();
  7. mainmenu.font = "schrift";
  8. mainmenu.size = 13;
  9. mainmenu.color = 0xffffff;
  10. mainmenu.align = "center";
  11.  
  12. MovieClip.prototype.alphaaus = function() {
  13.     this.onEnterFrame = function() {
  14.         this._alpha -= 5;
  15.         if (this._alpha<2) {
  16.             this._alpha = 0;
  17.         }
  18.     };
  19. };
  20. MovieClip.prototype.flaeche = function() {
  21.         createEmptyMovieClip("bg_main",100);
  22.         for(i=0; i<farben.length; i++) {
  23.             duplicateMovieClip("bg_main", "bg_main"+i, i+200);
  24.             x =_root["bg_main"+i]._x=i*117;
  25.             _root["bg_main"+i].onRollOver = function() {
  26.                     alphaaus();
  27.                 }
  28.             with(["bg_main"+i]) {
  29.                 beginFill(farben[i]);
  30.                 moveTo(x,0);
  31.                 lineTo(x,24);
  32.                 lineTo(x+117,24);
  33.                 lineTo(x+117,0);
  34.                 endFill();
  35.             }
  36.             _root.createEmptyMovieClip("container",1000);
  37.             duplicateMovieClip("container", "container"+i, i+1000);
  38.             removeMovieClip(_root.container);
  39.             _root["container"+i].createTextField("hauptmenu", i+1901, i*117-117, 2, 117, 24);
  40.             with (_root["container"+i].hauptmenu) {
  41.                 type='dynamic';
  42.                 embedFonts = true;
  43.                 selectable = false;
  44.                 text = main[i-1];
  45.                 setTextFormat(mainmenu);
  46.                 }
  47.         }
  48.         removeMovieClip(_root.bg_main)
  49. };
  50. flaeche();

LG
"E"
__________________
„Niemand versteht die Ledermäuse.“

Die Ledermäuse
"E" ist offline   Mit Zitat antworten
Alt 06-05-2005, 15:03   #4 (permalink)
mod_rewrite
 
Benutzerbild von sonar
 
Registriert seit: Feb 2003
Ort: München
Beiträge: 15.621
So, hier mal anhand von "alphaaus" und "flaeche" ein Ansatz, wie ich das in etwa angehen würde:
ActionScript:
  1. var farben = new Array ("0x063461", "0x21507F", "0x39648D", "0x52789C", "0x6B89AA", "0x839DB7", "0x569BC2");
  2. //
  3. MovieClip.prototype.alphaaus = function () {
  4.     this.onEnterFrame = function () {
  5.         this._alpha -= 5;
  6.         if (this._alpha < 2) {
  7.             this._alpha = 0;
  8.             delete this.onEnterFrame;
  9.         }
  10.     };
  11. };
  12. //
  13. function flaeche () {
  14.     var i = 0;
  15.     while (i < farben.length) {
  16.         this.createEmptyMovieClip ("btn" + i, i).lineStyle (0, 0, 0);
  17.         this["btn" + i].beginFill (farben[i], 100);
  18.         this["btn" + i].moveTo (0, 0);
  19.         this["btn" + i].lineTo (117, 0);
  20.         this["btn" + i].lineTo (117, 24);
  21.         this["btn" + i].lineTo (0, 24);
  22.         this["btn" + i].lineTo (0, 0);
  23.         this["btn" + i].endFill ();
  24.         this["btn" + i]._x = 117 * i;
  25.         this["btn" + i].onRollOver = function () {
  26.             this.alphaaus ();
  27.         };
  28.         i++;
  29.     }
  30. }
  31. flaeche ();
Das Problem bei dir war, dass du erst dupliziert und dann gefüllt hast - dadurch hatten alle MCs ein Breite von 0, was ein rollOver unmöglich macht...
__________________
RTFM
Wie man Fragen richtig stellt.

Achim Bindannmalweg

Money makes the world go round, fear makes it turn much faster.
(New Model Army)
sonar ist offline   Mit Zitat antworten
Alt 06-05-2005, 15:58   #5 (permalink)
"E"
fragonautin
 
Benutzerbild von "E"
 
Registriert seit: Aug 2001
Ort: Bremen
Beiträge: 174
Danke! Ich kuck mir das gleich einmal an!!
__________________
„Niemand versteht die Ledermäuse.“

Die Ledermäuse
"E" 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 11:12 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele