ERLEDIGT
JA
JA
ANTWORTEN
22
22
ZUGRIFFE
16448
16448
EMPFEHLEN
-
23.04.05 21:27 #16
Erweiterte Version - Nun sind Negative Zahlen, Nullenauffüllung und fehlerhafte Parameter kein Problem mehr.
Runden.as
Im Flash FilmPHP-Code:// --------------------------------------------------------------------
// Klasse: Runden (Extended)
//
// Definition: Runden.runden_extended(pZahl, Rundungsmodus, DezimalZeichen, Genauigkeit)
//
// pZahl - zu rundende Zahl
// pModus - Rundungsmodus (Auswahl: ceil, floor, round)
// pDezZeichen - Dezimal Trennzeichen
// pStellen - Prezision (Genauigkeit) - legt die Anzahl der Stellen nach dem Dezimalzeichen fest
//
// Syntax:
// gerundet_1 = Runden.runden_extended(zahl_1,"ceil", ",", 2);
//
// Anmerkung zu pModus - folgende Modien stehen zur Verfügung:
// "ceil" : (bsp: 10.1 -> 11 / 10.6 -> 11)
// "floor" : (bsp: 10.8 -> 10 / 10.6 -> 10)
// "round" : (bsp: 10.1 -> 10 / 10.6 -> 11)
//
// "ceil" : ceil (Obergrenze - ist die nächstliegende Ganzzahl, die größer oder gleich der Zahl ist)
// "floor" : floor (Untergrenze - ist die nächstliegende Ganzzahl, die kleiner oder gleich der angegebenen Zahl ist)
// "round" : round (Runden - rundet den Wert des Parameters x auf die nächstliegende Ganzzahl auf oder ab und gibt diese zurück)
//
// ---------------------------------------------------------------------
class Runden extends Number {
static function runden_extended(pZahl:Number, pModus:String, pDezZeichen:String, pStellen:Number) {
if ("ceil-floor-round".indexOf(pModus) == -1) {
return "runden-Fehler: unbekannter Modus!";
}
if (".,".indexOf(pDezZeichen) == -1) {
return "runden-Fehler: unbekanntes DezZeichen!";
}
if (pStellen != Math.abs(Math.round(pStellen))) {
return "runden-Fehler: ungeeignete Stellenangabe!";
}
var resultat = String(Math[pModus](pZahl*Math.pow(10, pStellen))/Math.pow(10, pStellen));
if (pStellen && resultat.indexOf("e") == -1) {
resultat += (resultat.indexOf(".") != -1) ? "" : ".";
var nullen = resultat.indexOf(".")-resultat.length+1+pStellen;
while (nullen--) {
resultat += "0";
}
}
return resultat.split(".").join(pDezZeichen);
}
}
Resultate:PHP-Code:// Verwenden - Beispiele
// Positive Werte
zahl_1 = 999.444536455;
zahl_2 = 999.444536455;
zahl_3 = 999.444536455;
zahl_4 = 999.44;
gerundet_1 = Runden.runden_extended(zahl_1, "ceil", ",", 2);
gerundet_2 = Runden.runden_extended(zahl_2, "floor", ".", 3);
gerundet_3 = Runden.runden_extended(zahl_3, "round", ",", 3);
gerundet_4 = Runden.runden_extended(zahl_4, "round", ",", 3);
trace("-----------------------------");
trace("Zahl 1 original: "+zahl_1);
trace("Zahl 1 gerundet: "+gerundet_1);
trace("Zahl 2 original: "+zahl_2);
trace("Zahl 2 gerundet: "+gerundet_2);
trace("Zahl 3 original: "+zahl_3);
trace("Zahl 3 gerundet: "+gerundet_3);
trace("Zahl 4 original: "+zahl_4);
trace("Zahl 4 gerundet: "+gerundet_4);
trace("-----------------------------");
// Negative Werte + Auffüllung
zahl_1 = -0.00123456789e-12;
zahl_2 = -123.456789;
zahl_3 = -0.35;
zahl_4 = 20;
trace("ceil : "+Runden.runden_extended(zahl_1, "ceil", ",", 0));
trace("floor: "+Runden.runden_extended(zahl_1, "floor", ".", 1));
trace("round: "+Runden.runden_extended(zahl_1, "round", ",", 20));
trace("ceil : "+Runden.runden_extended(zahl_2, "ceil", ",", 0));
trace("floor: "+Runden.runden_extended(zahl_2, "floor", ".", 4));
trace("round: "+Runden.runden_extended(zahl_2, "round", ",", 4));
trace("ceil : "+Runden.runden_extended(zahl_3, "ceil", ",", 0));
trace("floor: "+Runden.runden_extended(zahl_3, "floor", ".", 4));
trace("round: "+Runden.runden_extended(zahl_3, "round", ",", 4));
trace("ceil : "+Runden.runden_extended(zahl_4, "ceil", ",", 0));
trace("floor: "+Runden.runden_extended(zahl_4, "floor", ".", 4));
trace("round: "+Runden.runden_extended(zahl_4, "round", ",", 4));
trace("-----------------------------");
Liebe Grüsse-----------------------------
Zahl 1 original: 999.444536455
Zahl 1 gerundet: 999,45
Zahl 2 original: 999.444536455
Zahl 2 gerundet: 999.444
Zahl 3 original: 999.444536455
Zahl 3 gerundet: 999,445
Zahl 4 original: 999.44
Zahl 4 gerundet: 999,440
-----------------------------
ceil : 0
floor: -0.1
round: -1,23457e-15
ceil : -123
floor: -123.4568
round: -123,4568
ceil : 0
floor: -0.3500
round: -0,3500
ceil : 20
floor: 20.0000
round: 20,0000
-----------------------------
Matze K.FlashStar:
http://www.flashstar.de
[Flash Experimentals - News - Links]
Flashpower:
http://www.flashpower.de
[Flash Portal - Prototypes]
ActionScript Praxis:
http://www.actionscript-praxis.de
[Buchinfo - Ergänzungen - Zusatz Material]
Bücher zu Flash 8 und CS3:
HotStuff Buch -=- Professional Series Buch -=- Flash CS3 Powerworkshops
-
16.05.05 15:56 #17
Hier eine Sammlung von nützlichen Zoom-Prototypes.
Zusatz:PHP-Code:MovieClip.prototype.ZoomDiv = function (pDim, pTempo)
{
this.onEnterFrame = function ()
{
if (this._xscale < pDim - 1 / pTempo)
{
this._xscale = this._xscale + (pDim - this._xscale) / pTempo;
this._yscale = this._yscale + (pDim - this._yscale) / pTempo;
}
else if (this._xscale > pDim + 1 / pTempo)
{
this._xscale = this._xscale + (pDim - this._xscale) / pTempo;
this._yscale = this._yscale + (pDim - this._yscale) / pTempo;
}
else
{
this._xscale = this._yscale = pDim;
delete this.onEnterFrame;
}
};
};
ASSetPropFlags(MovieClip.prototype, "ZoomDiv", 1);
MovieClip.prototype.ZoomPulsar = function (pDim, pTempo)
{
this.onEnterFrame = function ()
{
if (this._xscale < pDim)
{
this._xscale = this._yscale += pTempo;
}
else if (this._xscale > pDim)
{
this._xscale = this._yscale -= pTempo;
}
else
{
this._xscale = this._yscale = pDim;
delete this.onEnterFrame;
}
};
};
ASSetPropFlags(MovieClip.prototype, "ZoomPulsar", 1);
MovieClip.prototype.ZoomAdd = function (pOption, pDim, pTempo)
{
if (pOption)
{
this.onEnterFrame = function ()
{
if (this._xscale < pDim)
{
this._xscale = this._yscale += pTempo;
}
else
{
this._xscale = this._yscale = pDim;
delete this.onEnterFrame;
}
};
}
else
{
this.onEnterFrame = function ()
{
if (this._xscale > pDim)
{
this._xscale = this._yscale -= pTempo;
}
else
{
this._xscale = this._yscale = pDim;
delete this.onEnterFrame;
}
};
}
};
ASSetPropFlags(MovieClip.prototype, "ZoomAdd", 1);
// Ausfürhen (Testen)
mc.onRollOver = function ()
{
this.ZoomDiv (200, 6);
};
mc.onRollOut = function ()
{
this.ZoomDiv (100, 6);
};
mc2.onRollOver = function ()
{
this.ZoomPulsar (200, 6);
};
mc2.onRollOut = function ()
{
this.ZoomPulsar (100, 6);
};
mc3.onRollOver = function ()
{
this.ZoomAdd (true, 200, 6);
// ZoomIn (true)
};
mc3.onRollOut = function ()
{
this.ZoomAdd (false, 100, 6);
// ZoomOUt (false)
};
// Interval-Varianten
MovieClip.prototype.ZoomInterval = function (pOption, pDim, pTempo, pBps)
{
var obj = this;
clearInterval(obj.iv);
if (pOption)
{
obj.zoomIn = function ()
{
if (obj._xscale < pDim)
{
obj._xscale = obj._yscale += pTempo;
}
else
{
obj._xscale = obj._yscale = pDim;
clearInterval(obj.iv);
delete obj.iv;
delete obj.zoomIn;
delete obj.zoomOut;
}
};
obj.iv = setInterval(obj.zoomIn,1000/pBps);
}
else
{
obj.zoomOut= function ()
{
if (obj._xscale > pDim)
{
obj._xscale = obj._yscale -= pTempo;
}
else
{
obj._xscale = obj._yscale = pDim;
clearInterval(obj.iv);
delete obj.iv;
delete obj.zoomIn;
delete obj.zoomOut;
}
};
obj.iv = setInterval(obj.zoomOut,1000/pBps);
}
};
ASSetPropFlags(MovieClip.prototype, "ZoomInterval", 1);
mc4.onRollOver = function ()
{
this.ZoomInterval (true, 200, 6, 24); // ZoomIn (true) / 24 -> 24 Bps (Dokument-Einstellung)
};
mc4.onRollOut = function ()
{
this.ZoomInterval (false, 100, 6, 24); // ZoomOUt (false) / 24 -> 24 Bps (Dokument-Einstellung)
};
MovieClip.prototype.ZoomIntervalDiv = function (pDim, pTempo, pBps)
{
var obj = this;
clearInterval(obj.iv);
obj.zoom = function ()
{
if (obj._xscale < pDim - 1 / pTempo)
{
obj._xscale = obj._xscale + (pDim - obj._xscale) / pTempo;
obj._yscale = obj._yscale + (pDim - obj._yscale) / pTempo;
}
else if (obj._xscale > pDim + 1 / pTempo)
{
obj._xscale = obj._xscale + (pDim - obj._xscale) / pTempo;
obj._yscale = obj._yscale + (pDim - obj._yscale) / pTempo;
}
else
{
obj._xscale = obj._yscale = pDim;
clearInterval(obj.iv);
delete obj.iv;
delete obj.zoom;
}
};
obj.iv = setInterval(obj.zoom,1000/pBps);
};
ASSetPropFlags(MovieClip.prototype, "ZoomIntervalDiv", 1);
mc5.onRollOver = function ()
{
this.ZoomIntervalDiv (200, 6, 24);
};
mc5.onRollOut = function ()
{
this.ZoomIntervalDiv (100, 6, 24);
};
Be inspired...PHP-Code:Object.prototype.ZoomIntervalDiv = function (pDim, pTempo, pBps)
{
var obj = this;
clearInterval(obj.iv);
obj.zoom = function ()
{
if (obj._xscale < pDim - 1 / pTempo)
{
obj._xscale = obj._xscale + (pDim - obj._xscale) / pTempo;
obj._yscale = obj._yscale + (pDim - obj._yscale) / pTempo;
}
else if (obj._xscale > pDim + 1 / pTempo)
{
obj._xscale = obj._xscale + (pDim - obj._xscale) / pTempo;
obj._yscale = obj._yscale + (pDim - obj._yscale) / pTempo;
}
else
{
obj._xscale = obj._yscale = pDim;
clearInterval(obj.iv);
delete obj.iv;
delete obj.zoom;
}
};
obj.iv = setInterval(obj.zoom,1000/pBps);
};
ASSetPropFlags(Object.prototype, "ZoomIntervalDiv", 1);
clip_mc.onRollOver = function ()
{
this.ZoomIntervalDiv (200, 6, 24);
};
clip_mc.onRollOut = function ()
{
this.ZoomIntervalDiv (100, 6, 24);
};
but_btn.onRollOver = function ()
{
this.ZoomIntervalDiv (200, 6, 24);
};
but_btn.onRollOut = function ()
{
this.ZoomIntervalDiv (100, 6, 24);
};
Liebe Grüsse
Matze K.FlashStar:
http://www.flashstar.de
[Flash Experimentals - News - Links]
Flashpower:
http://www.flashpower.de
[Flash Portal - Prototypes]
ActionScript Praxis:
http://www.actionscript-praxis.de
[Buchinfo - Ergänzungen - Zusatz Material]
Bücher zu Flash 8 und CS3:
HotStuff Buch -=- Professional Series Buch -=- Flash CS3 Powerworkshops
-
Hi,
hier ein Beispiel für einen Videoplayer, mit dem sich Videodateien im Flash Video Format abspielen lassen. Damit der Player korrekt funktioniert, müssen FLV 1.1 - Dateien mit Meta-Daten verwendet werden. Eine kostenlose Software zum Erstellen und Einfügen dieser Daten gibt es hier: http://www.buraks.com/flvmdi/ .
Der Pfad zum Video sowie ein Flash zum automatischen Abspielen werden per FlashVars übergeben:Code :1 2 3
// FlashVars-Parameter: filename=mein_video.flv autostart=true
Im Anhang .fla und .swf
Danke noch einmal an Chris Kurt für den Tipp mit onMetaData.
Gruß
.
-
29.05.05 00:56 #19
MovieClip Prototype (Textfeld Komponentenversion):
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
MovieClip.prototype.fpsmeter = function () { this.zaehler = 0; this.onEnterFrame = function () { this.zaehler++; }; anzeigen = function () { this.display_txt.text = this.zaehler; this.zaehler = 0; }; setInterval (this, "anzeigen", 1000); }; ASSetPropFlags (MovieClip.prototype, "fpsmeter", 1); this.fpsmeter ();
Komponentendownload:
http://www.flashstar.de/tutlist/index.php3?id=1042
MovieClip Prototype (Trace Version):
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
MovieClip.prototype.fpsmeter = function () { this.zaehler = 0; this.onEnterFrame = function () { this.zaehler++; }; anzeigen = function () { trace(this.zaehler); this.zaehler = 0; }; setInterval (this, "anzeigen", 1000); }; ASSetPropFlags (MovieClip.prototype, "fpsmeter", 1); this.fpsmeter ();
Die Alte Version nochmal schnell durchgereicht:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Object.prototype.getFps = function () { if (signal == true) { time = getTimer (); } else { tempo = Math.ceil (1000 / (getTimer () - time)); } signal = !signal; return tempo; }; this.onEnterFrame = function () { trace (getFps ()); };
Be inspired
Liebe Grüsse
Matze K.FlashStar:
http://www.flashstar.de
[Flash Experimentals - News - Links]
Flashpower:
http://www.flashpower.de
[Flash Portal - Prototypes]
ActionScript Praxis:
http://www.actionscript-praxis.de
[Buchinfo - Ergänzungen - Zusatz Material]
Bücher zu Flash 8 und CS3:
HotStuff Buch -=- Professional Series Buch -=- Flash CS3 Powerworkshops
-
03.06.05 18:42 #20
Hab noch schnell die extended Version zusammengestellt in deutsch und english:
English-VersionPHP-Code:MovieClip.prototype.fpsmeter_extended = function (aktion, ausgabe)
{
if (aktion == "start")
{
this.zaehler = 0;
this.onEnterFrame = function ()
{
this.zaehler++;
};
this.anzeigen = function ()
{
if (ausgabe == "trace")
{
trace (this.zaehler);
}
else
{
this[ausgabe].text = this.zaehler;
}
this.zaehler = 0;
};
this.fps_iv = setInterval (this, "anzeigen", 1000);
}
else if (aktion == "stop")
{
clearInterval (this.fps_iv);
delete this.onEnterFrame;
delete this.anzeigen;
delete this.fps_iv;
delete this.zaehler;
}
};
ASSetPropFlags (MovieClip.prototype, "fpsmeter_extended", 1);
// Usage
// Trace ausgabe
this.fpsmeter_extended ("start", "trace");
// Textfeld ausgabe
this.fpsmeter_extended ("start","feld_name");
Natürlich ist auch diese Version für MX als auch MX 2004 geeignet und die Komponente wird ab Samstag auf flashstar.de zu finden sein.PHP-Code:// English Version - Extendend (Trace and TextField)
MovieClip.prototype.fpsmeter_extended = function (action, output)
{
if (action == "start")
{
this.counter = 0;
this.onEnterFrame = function ()
{
this.counter++;
};
this.display = function ()
{
if (output == "trace")
{
trace (this.counter);
}
else
{
this[output].text = this.counter;
}
this.counter = 0;
};
this.fps_iv = setInterval (this, "display", 1000);
}
else if (action == "stop")
{
clearInterval (this.fps_iv);
delete this.onEnterFrame;
delete this.display;
delete this.fps_iv;
delete this.counter;
}
};
ASSetPropFlags (MovieClip.prototype, "fpsmeter_extended", 1);
// Usage
// Trace output
this.fpsmeter_extended ("start", "trace");
// TextField output
this.fpsmeter_extended ("start","field_name");
Liebe Grüsse
Matze K.FlashStar:
http://www.flashstar.de
[Flash Experimentals - News - Links]
Flashpower:
http://www.flashpower.de
[Flash Portal - Prototypes]
ActionScript Praxis:
http://www.actionscript-praxis.de
[Buchinfo - Ergänzungen - Zusatz Material]
Bücher zu Flash 8 und CS3:
HotStuff Buch -=- Professional Series Buch -=- Flash CS3 Powerworkshops
-
Matthias, Du produzierst die Tipps so fix, da kommt man ja mit dem Verschieben kaum noch nach.

Gruß
.
-
[ ...außerdem geht es wohl mit AS! ]
Ich habe ein derartiges Script vor ca. einem Jahr geschrieben und im FlashForum veröffentlicht.. leider ist es seit dem Forum-Hack nicht mehr auffindbar...sry
Wenn noch jemand interesse daran hat, könnte ich das Prinzip aber mal erläutern!
So kompliziert, wie ihr es darstellt ist es nämlich auch nicht
grz
pape
edit:
so in etwa müsste es aussehen:
lala = der MovieClip, der aufgerollt werden soll (mittig ausgerichtet)
mit getBounds ginge es noch um einiges schönerPHP-Code:MovieClip.prototype.male_maske = function () {
this.beginFill(0x000000, 100);
this.lineTo(0,1);
this.lineTo(1,1);
this.lineTo(1,0);
this.endFill();
}
MovieClip.prototype.aufrollen = function (speed, delay) {
maske1 = this._parent.createEmptyMovieClip("mask1",this.getDepth()+1);
maske1.male_maske();
maske1._y = this._y-this._height/2+this._height+1;
maske1._x = this._x-this._width/2;
maske1._height = 1;
maske1._width = this._width;
maske2 = maske1.duplicateMovieClip("mask2", this.getDepth()+3);
kopie = this.duplicateMovieClip("copy", this.getDepth()+2);
this.setMask(maske1);
kopie.setMask(maske2);
kopie._yscale *= -1;
kopie._y = this._y+this._height;
delay2 = delay/10;
speed2 = 100/speed*delay2;
rollmc = this.createEmptyMovieClip("roller",100);
rollmc.onEnterFrame = function () {
oriy = this._parent._y;
orih = this._parent._height;
disty = kopie._y-(oriy-orih);
if (disty<2.2) {
kopie._y = oriy-orih;
maske1._y = oriy-orih/2;
maske1._height = orih+1;
maske2._y = oriy-orih/2;
maske2._height = orih+1;
delete this.onEnterFrame;
} else {
kopie._y -= disty/speed2;
maske1._y -= disty/speed2/2;
maske1._height += disty/speed2/2;
maske2._y -= disty/speed2/2;
maske2._height = disty/speed2/2;
}
}
}
lala.aufrollen(15, 50);//parameter: speed, delay
.. soll nur nen ansatz sein
mfG
eigentlich ein netter Ansatz, obwohl man das Aufrollen nur bei detailreichen Clips wirklich gut erkennt.
Ich nehme das Posting mal aus dem Ursprungsthread heraus, weil wir allzu alte Themen nicht ewig wiederbeleben wollen und die damaligen Poster wahrscheinlich nicht mehr davon profitieren können.
- Datic
.Geändert von Datic (13.06.05 um 01:54 Uhr)
-
Hi,
aufgrund mehrerer Nachfragen gibts hier jetzt eine neue Version der scrollenden Bilderleiste mit integriertem Preloader.
Die Pfade zu den Bildern und Thumbnails werden der Leiste als Arrays übergeben. Prinzipiell könnt Ihr in dieser Galerie die Maße der Komponenten (Thumbnail, Slider, Anzeigefenster) beliebig ändern, ohne das Script verändern zu müssen. Achtet nur darauf, dass die Bezeichner und Positionen der MovieClips erhalten bleiben.
UPDATE: Die slide_gallery_xZOOM enthält optionale Bildlupen sowohl für die Thumbnails als auch für die Großansicht. Beide Lupen können mit Variablen auf der Hauptzeitleiste eingestellt werden.
Im Anhang findet Ihr die Galerie für Flash MX und MX2004.
Viel Spaß
.Geändert von Datic (02.08.05 um 16:19 Uhr)
Ähnliche Themen
-
Thread im Thread
Von Maik20 im Forum JavaAntworten: 1Letzter Beitrag: 10.03.09, 10:46 -
Thread?
Von andreas_gierisch im Forum C/C++Antworten: 1Letzter Beitrag: 23.07.08, 14:39 -
Thread A stösst Änderung in Thread B an. Aber wie?
Von BeaTBoxX im Forum .NET CaféAntworten: 12Letzter Beitrag: 13.12.06, 11:52 -
Thread
Von SirWayne im Forum JavaAntworten: 8Letzter Beitrag: 12.04.06, 10:21 -
max - c4d (Thread split by IKEAFREAX on 09.07.2002 23:43 (thread by pasq))
Von pasq im Forum 3D Studio MaxAntworten: 19Letzter Beitrag: 12.07.02, 11:13





Zitieren
Login





