| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: Jun 2009
Beiträge: 3
| Zufallsbild
Hallo Gemeinde Ich bin nicht wirklich so der Crack, habe da eine kleine Bildergalerie runtergeladen und will diese nun ergänzen. Und zwar sollten die Bilder in einer zufälligen Reihenfolge dargestelt werden. Kann mir hier jemand helfen? - Danke HTML-Code: pic_arr = ["flower_pink.jpg", "flower_yellow.jpg", "flower_purple.jpg", "flower_red.jpg", "flower_orange.jpg"];
color_arr = [0xf75eb0, 0xf6f818, 0xbb57c8, 0xdf1734, 0xfe9809];
// specify pic locations, alpha increment each frame, and
// number of frames to keep current picture displayed before
// transitioning to the next one
blank_mc.attachMovie("slideshow", "uuShow", 1, {
_x:0, _y:0, _visible:false, fps:12, nFrames:24, alphaIncr:10,
slides_arr:pic_arr, slideDepth:50, repeat:true});
// tell blank_mc to listen for events broadcast by uuShow
blank_mc.uuShow.addListener(blank_mc);
blank_mc.onSlideLoaded = function(i) {
(new Color(this._parent["dot"+i+"_mc"])).setRGB(color_arr[i]);
// trace('slide '+ i + ' loaded');
};
blank_mc.onAllSlidesLoaded = function() {
this.uuShow._visible = true;
this.uuShow.beginTransitions();
};
blank_mc.onShowOver = function() {
//set repeat:false in uuShow for this to be called
//trace('slideshow is over');
}; |
| | |
| | #2 (permalink) |
| asFlasher Registriert seit: Jul 2006
Beiträge: 1.136
|
Hallo, man muss aber kein Crack sein, um die Suchfunktion des Forum zu benutzen ![]() Mögliche Schlagwörter: array, mischen, shuffle, zufall ... sowas eben, da gibt es einiges interessantes zu finden...als Beispiel: http://flashforum.de/forum/showthrea...=array+mischen Gruß ksw24 |
| | |
| | #4 (permalink) |
| Haaajmo Bosno!!! Registriert seit: Aug 2001 Ort: Bihać
Beiträge: 692
|
Versuch Mal mit Array Shuffle: Array.prototype.shuffle = function (times) { var max = this.length; var a, b, temp; while(times--){ a = Math.floor(Math.random() * max); b = Math.floor(Math.random() * max); temp = this[a]; this[a] = this[b]; this[b] = temp; } } Dann: pic_arr = ["flower_pink.jpg", "flower_yellow.jpg", "flower_purple.jpg", "flower_red.jpg", "flower_orange.jpg"]; color_arr = [0xf75eb0, 0xf6f818, 0xbb57c8, 0xdf1734, 0xfe9809]; pic_arr.shuffle(5); color_arr.shuffle(5);
__________________ http://www.oreillynet.com/pub/au/3675 |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |