Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 03-09-2004, 00:00   #1 (permalink)
flashgirl
 
Registriert seit: Sep 2004
Beiträge: 33
Question interaktive matrix

hallo allerseits,

ihr könnt das vermutlich garnicht mehr hören, aber ich bin noch ein as newbie. *schäm*

möchte dennoch lernen/wissen wie ich folgendes lösen kann:

1. möchte anhand eines movieclip aus der library per attach und duplicate ein muster mit 9 spalten und 6 reihen erstellen.
2. wenn man mit der maus über diese matrix fährt sollen sich alle MCs im umkreis von 50px abnehmend vergrößern. hmmm... schwer zu erklären hab leider kein beispiel zur hand. also... als würde man an einem knoten eines netzes ziehen und alle umliegenden konten kommen auch näher, aber eben abnehmend.

was einer was ich mein?

liebe grüße

sabrina
sabrina ist offline   Mit Zitat antworten
Alt 03-09-2004, 00:32   #2 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Hi.

Das kannst Du hier finden.
download

Das aus der Bibliothek attachen, kannst Du
so machen:

ActionScript:
  1. posX = 25;
  2. posY = 25;
  3. //-------------------------------------------
  4. for (i = 1; i < 26; i++) {
  5.  _root.attachMovie("box", "box" + i, i);
  6.  _root["box" + i]._x = posX;
  7.  _root["box" + i]._y = posY;
  8.  if (i % 5 != 0) {
  9.   posX += 50;
  10.  } else {
  11.   posX = 25;
  12.   posY += 50;
  13.  }
  14. }
  15. //-------------------------------------------
  16.  
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------

Geändert von thebiz (03-09-2004 um 00:34 Uhr)
thebiz ist offline   Mit Zitat antworten
Alt 03-09-2004, 10:20   #3 (permalink)
flashgirl
 
Registriert seit: Sep 2004
Beiträge: 33
hey, das ist genau was ich gesucht habe. werd`s gleich mal ausprobieren.
bist ein schatz. Danke.
__________________
liebe grüße

sabrina
sabrina ist offline   Mit Zitat antworten
Alt 03-09-2004, 11:16   #4 (permalink)
flashgirl
 
Registriert seit: Sep 2004
Beiträge: 33
wie kann ich nun aber den movieclip "box" in diese matrix integrieren? hier wird ja ein rechteck gezeichnet. wie ersetz ich das durch meinen movieclip aus der library?

PHP-Code:
MovieClip.prototype.setMatrix = function (pClippReihenpSpaltepDimpDistpFarbepAlpha
pAbstandpMaxpMinpMultpFraktion) {
    var 
tiefe;
    for (var 
0i<pReiheni++) {
        for (var 
0j<pSpaltej++) {
            
this[pClip] = this.createEmptyMovieClip(pClip+j+"_"+itiefe++);
            
with (this[pClip]) {
                
beginFill(pFarbepAlpha);
                
moveTo(-pDim, -pDim);
                
lineTo(pDim, -pDim);
                
lineTo(pDimpDim);
                
lineTo(-pDimpDim);
                
lineTo(-pDim, -pDim);
                
_x Math.round(i*((2*pDim)+pDist)+Stage.width/2-((pReihen-1)*((2*pDim)+pDist)/2));
                
_y Math.round(j*((2*pDim)+pDist)+Stage.height/2-((pSpalte-1)*((2*pDim)+pDist)/2));
            }
            
this[pClip].onEnterFrame = function() {
                
this.abstX this._x-_root._xmouse;
                
this.abstY this._y-_root._ymouse;
                
this.abstand Math.sqrt((this.abstX*this.abstX)+(this.abstY*this.abstY));
                if (
this.abstand<pAbstand) {
                    
this.dimX pMax-this.abstand;
                    
this.dimY pMax-this.abstand;
                } else {
                    
this.dimX pMin;
                    
this.dimY pMin;
                }
                
this.skalX = ((this.dimX-this._xscale)*pMult)+(this.skalX*pFraktion);
                
this.skalY = ((this.dimY-this._yscale)*pMult)+(this.skalY*pFraktion);
                
this._xscale += this.skalX;
                
this._yscale += this.skalY;
            };
        }
    }
}

// Ebene 1
this.setMatrix("feld"10101040x0000ff25150250100 ,.36.75); 
__________________
liebe grüße

sabrina
sabrina ist offline   Mit Zitat antworten
Alt 03-09-2004, 13:12   #5 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Hi.

Das ich ein Schatz bin, höre ich total gerne!
Vielen Dank.

Habe gerade gemerkt, dass der Code nur für Flash 6
und nicht für Flash 7 funktioniert. Falls Du also Flash MX 2004
benutzt, schaue Dir die Einstellungen für die Veröffentlichung an,
falls es nicht geht.

Das attachen kannst Du so einbauen:

ActionScript:
  1. MovieClip.prototype.setMatrix = function(pClip, pReihen, pSpalte, pDim, pDist, pFarbe, pAlpha, pAbstand, pMax, pMin, pMult, pFraktion) {
  2.  var tiefe;
  3.  var posX = 25;
  4.  var posY = 25;
  5.  for (j = 1; j < 26; j++) {
  6.   _root.attachMovie("box", "box" + j, j);
  7.   _root["box" + j]._x = posX;
  8.   _root["box" + j]._y = posY;
  9.   if (j % 5 != 0) {
  10.    posX += 50;
  11.   } else {
  12.    posX = 25;
  13.    posY += 50;
  14.   }
  15.   _root["box" + j].onEnterFrame = function() {
  16.    this.abstX = this._x - _root._xmouse;
  17.    this.abstY = this._y - _root._ymouse;
  18.    this.abstand = Math.sqrt((this.abstX * this.abstX) + (this.abstY * this.abstY));
  19.    if (this.abstand < pAbstand) {
  20.     this.dimX = pMax - this.abstand;
  21.     this.dimY = pMax - this.abstand;
  22.    } else {
  23.     this.dimX = pMin;
  24.     this.dimY = pMin;
  25.    }
  26.    this.skalX = ((this.dimX - this._xscale) * pMult) + (this.skalX * pFraktion);
  27.    this.skalY = ((this.dimY - this._yscale) * pMult) + (this.skalY * pFraktion);
  28.    this._xscale += this.skalX;
  29.    this._yscale += this.skalY;
  30.   };
  31.  }
  32. };
  33. // Ebene 1
  34. _root.setMatrix("feld", 10, 10, 10, 4, 0x0000ff, 25, 150, 250, 100, .36, .75);
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz ist offline   Mit Zitat antworten
Alt 03-09-2004, 13:20   #6 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Stop. Du brauchst garnicht alles,
was da so drinnen stand.
So ist es besser:

ActionScript:
  1. MovieClip.prototype.setMatrix = function(pDim, pDist, pFarbe, pAlpha, pAbstand, pMax, pMin, pMult, pFraktion) {
  2.  var posX = 25;
  3.  var posY = 25;
  4.  for (j = 1; j < 26; j++) {
  5.   _root.attachMovie("box", "box" + j, j);
  6.   _root["box" + j]._x = posX;
  7.   _root["box" + j]._y = posY;
  8.   if (j % 5 != 0) {
  9.    posX += 50;
  10.   } else {
  11.    posX = 25;
  12.    posY += 50;
  13.   }
  14.   _root["box" + j].onEnterFrame = function() {
  15.    this.abstX = this._x - _root._xmouse;
  16.    this.abstY = this._y - _root._ymouse;
  17.    this.abstand = Math.sqrt((this.abstX * this.abstX) + (this.abstY * this.abstY));
  18.    if (this.abstand < pAbstand) {
  19.     this.dimX = pMax - this.abstand;
  20.     this.dimY = pMax - this.abstand;
  21.    } else {
  22.     this.dimX = pMin;
  23.     this.dimY = pMin;
  24.    }
  25.    this.skalX = ((this.dimX - this._xscale) * pMult) + (this.skalX * pFraktion);
  26.    this.skalY = ((this.dimY - this._yscale) * pMult) + (this.skalY * pFraktion);
  27.    this._xscale += this.skalX;
  28.    this._yscale += this.skalY;
  29.   };
  30.  }
  31. };
  32. _root.setMatrix(10, 4, 0x0000ff, 25, 150, 250, 100, .36, .75);
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz ist offline   Mit Zitat antworten
Alt 03-09-2004, 14:51   #7 (permalink)
flashgirl
 
Registriert seit: Sep 2004
Beiträge: 33
vielen lieben Dank. das hat super geklappt.
Du bist echt ein Schatz!

als nächstes möchte ich nebel bzw. dunst erzeugen. mit transparent animierten verläufen ... ??? mal probieren.
__________________
liebe grüße

sabrina
sabrina ist offline   Mit Zitat antworten
Alt 03-09-2004, 16:29   #8 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Ach wie lange habe ich das nicht mehr
von einer Frau gehört, dass ich ein Schatz bin.

Ich will den Tag jedoch nicht vor dem Abend
loben.

Das mit dem Nebel, habe ich auch noch nicht gemacht.

Bist ja auch ein Pixelschubser (Mediengestalter/in).
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz 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 16:42 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele