Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Random Slideshow Using Flash?


Does anybody have a code that will generate random slideshow just like apple computer screensaver but in flash? with the same kind of motion and transitioning?




ActionScript.org Forums > Flash General Questions > Flash 8 General Questions
Posted on: 08-22-2006, 03:33 PM


View Complete Forum Thread with Replies

Sponsored Links:

Adding Fade-in To Xml Random Slideshow Flash
hi guys im working on a random slideshow gallery that uses xml to populate the mc, and it works great, but now i want to add a fade-in effect for each 1 of the pics, or maybe a cross-fade,this is the script i have so far, any help will be appreciated.


Code:
pauseTime = 2000;

xmlImages = new XML();
xmlImages.ignoreWhite = true;
xmlImages.onLoad = loadImages;
xmlImages.load("images.xml");

function loadImages(loaded) {
if (loaded) {
xmlFirstChild = this.firstChild;
imageFileName = [];
totalImages = xmlFirstChild.childNodes[0].childNodes.length;
for (i=0; i<totalImages; i++) {
imageFileName[i] = xmlFirstChild.childNodes[0].childNodes[i].attributes.title;
}
randomImage();
}
}
function randomImage() {
if (loaded == filesize) {
var ran = Math.round(Math.random() * (totalImages - 1));
picture_mc.loadMovie(imageFileName[ran], 1);
pause();
}
}
function pause() {
myInterval = setInterval(pause_slideshow, pauseTime);
function pause_slideshow() {
clearInterval(myInterval);
randomImage();
}
}

View Replies !    View Related
Starting With Random Image: Photo Slideshow Using XML And Flash
i want to strip this down and remove the image counter, description and buttons... which is easy enough.

but i would also like the starting image to be random. i mean, the first image that is loaded is selected randomly from the xml file.

can anyone help me with the real quick? here is the AS


delay = 6000;
//-----------------------
function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;

}
firstImage();

} else {

content = "file not loaded!";

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");

p = 0;
this.onEnterFrame = function() {

filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {

preloader.preload_bar._xscale = 100*loaded/filesize;

} else {

preloader._visible = false;
if (picture._alpha<100) {

picture._alpha += 10;

}

}

};
function nextImage() {

if (p<(total-1)) {

p++;
if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();

}

}

}
function prevImage() {

if (p>0) {

p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();

}

}
function firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
slideshow();

}

}
function picture_num() {

current_pos = p+1;
pos_txt.text = current_pos+" / "+total;

}
function slideshow() {

myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {

clearInterval(myInterval);
if (p == (total-1)) {

p = 0;
firstImage();

} else {

nextImage();

}

}

}

View Replies !    View Related
Random Slideshow
Hey everyone, i am trying to complete a project and the client requested a "random" behavior from the movie, and though i know in my head how i could do it, i have no idea how to translate this to AScript. if anybody can help, it would be awesome.

The main thing I need to do is:

A set of 8 movie clips, on a slideshow sequence. (1,2,3,4...8)

Slideshow will play automatically when the page is loaded.

Slideshow would select a random MC everytime the page is loaded.

All the MCs will be transitioning into each other on the main timeline.

Any ideas on how I could do this?

View Replies !    View Related
Random XML Slideshow
It's that time again - I pretend I know what I'm doing when it comes to Actionscript.

Here's a mod to the MM XML slideshow that Mediachrome on were-here came up with:


stop();
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
}
}

//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
}
//
//AutoPlay code
myImg = setInterval(test, 5*1000);
function test() {
if (currentIndex>=totalSlides or nextSlideNode == totalSlides+1) {
currentIndex = 1;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
updateSlide(firstSlideNode);
} else {
nextSlideNode = currentSlideNode.nextSibling;
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}
Can anyone help me to add a fade effect between each image? Please bear in mind I'm a designer and am more at home with pretty colours and interesting typography.

For some extra points I'd be for ever indebted to the person who could tell me how bring the slides out in a random order. That would blow my mind! I know I need to use Math.random but I don't know how to apply it.

Thanks all.

View Replies !    View Related
Random Slideshow
I've gone through the forum over and over again to find a solution to my problem.. and I've come up unlucky. Unless I've overlooked something, in which case I still need help.

I used the tutorial for Photo Gallery Using XML and Flash on the site. I originally used the code for the slideshow, but the need for back, forward, and pause buttons was called for. Then, I needed the slideshow to load the first image randomly from the XML file, which it does. However, I'd like to code it so that it continues in a non-random order from the current picture it is on. Say, if it randomly loads the 8th image in a set of 20, I want the slideshow to continue to image 9 in the xml file, so on and so forth. Is this possible?

Here is my actionscript:


Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
}
randomImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
controls.play_btn._visible = 0;
p = 0;
delay = 7000;
controls.pause_btn.onRelease = function() {
clearInterval(myInterval);
controls.pause_btn._visible = 0;
controls.play_btn._visible = 100;
};
controls.play_btn.onRelease = function() {
myInterval = setInterval(pause_slideshow, delay);
controls.pause_btn._visible = 100;
controls.play_btn._visible = 0;
};
controls.previous_btn.onRelease = function() {
if (p == 0) {
p = total;
lastImage();
}else{
prevImage();
}
if (p == (total-1)) {
prevImage();
}
};
controls.next_btn.onRelease = function() {
//nextImage();
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
};
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
controls.pause_btn._visible = 100;
controls.play_btn._visible = 0;
if (p<(total-1)) {
p++;
if (loaded == filesize) {
clearInterval(myInterval);
picture._alpha = 0;
picture.loadMovie(image[p], 1);
slideshow();
}
}
}
function prevImage() {
controls.pause_btn._visible = 100;
controls.play_btn._visible = 0;
if (p>0) {
p--;
clearInterval(myInterval);
picture._alpha = 0;
picture.loadMovie(image[p], 1);
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
slideshow();
}
}
function lastImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[total-1], 1);
slideshow();
}
}
function randomImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[random(total)], 1);
}
slideshow();
}

function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
}
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}

View Replies !    View Related
Random XML Slideshow
It's that time again - I pretend I know what I'm doing when it comes to Actionscript.

Here's a mod to the MM XML slideshow that Mediachrome on were-here came up with:


stop();
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
}
}

//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
}
//
//AutoPlay code
myImg = setInterval(test, 5*1000);
function test() {
if (currentIndex>=totalSlides or nextSlideNode == totalSlides+1) {
currentIndex = 1;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
updateSlide(firstSlideNode);
} else {
nextSlideNode = currentSlideNode.nextSibling;
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
}
Can anyone help me to add a fade effect between each image? Please bear in mind I'm a designer and am more at home with pretty colours and interesting typography.

For some extra points I'd be for ever indebted to the person who could tell me how bring the slides out in a random order. That would blow my mind! I know I need to use Math.random but I don't know how to apply it.

Thanks all.

View Replies !    View Related
Random Slideshow
I used the tutorial for Photo Gallery Using XML and Flash on the Kirupa website. I originally used the code for the slideshow, but the need for back, forward, and pause buttons was called for. Then, I needed the slideshow to load the first image randomly from the XML file, which it does. However, I'd like to code it so that it continues in a non-random order from the current picture it is on. Say, if it randomly loads the 8th image in a set of 20, I want the slideshow to continue to image 9 in the xml file, so on and so forth. Is this possible?

Here is my actionscript:

Code:

function loadXML(loaded) {
   if (loaded) {
      xmlNode = this.firstChild;
      image = [];
      total = xmlNode.childNodes.length;
      for (i=0; i<total; i++) {
         image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
      }
      randomImage();
   } else {
      content = "file not loaded!";
   }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
controls.play_btn._visible = 0;
p = 0;
delay = 7000;
controls.pause_btn.onRelease = function() {
   clearInterval(myInterval);
   controls.pause_btn._visible = 0;
   controls.play_btn._visible = 100;
};
controls.play_btn.onRelease = function() {
   myInterval = setInterval(pause_slideshow, delay);
   controls.pause_btn._visible = 100;
   controls.play_btn._visible = 0;
};
controls.previous_btn.onRelease = function() {
   if (p == 0) {
      p = total;
      lastImage();
   }else{
      prevImage();
   }
   if (p == (total-1)) {
      prevImage();
   }
};
controls.next_btn.onRelease = function() {
   //nextImage();
   if (p == (total-1)) {
      p = 0;
      firstImage();
   } else {
      nextImage();
   }
};
this.onEnterFrame = function() {
   filesize = picture.getBytesTotal();
   loaded = picture.getBytesLoaded();
   preloader._visible = true;
   if (loaded != filesize) {
      preloader.preload_bar._xscale = 100*loaded/filesize;
   } else {
      preloader._visible = false;
      if (picture._alpha<100) {
         picture._alpha += 10;
      }
   }
};
function nextImage() {
   controls.pause_btn._visible = 100;
   controls.play_btn._visible = 0;
   if (p<(total-1)) {
      p++;
      if (loaded == filesize) {
         clearInterval(myInterval);
         picture._alpha = 0;
         picture.loadMovie(image[p], 1);
         slideshow();
      }
   }
}
function prevImage() {
   controls.pause_btn._visible = 100;
   controls.play_btn._visible = 0;
   if (p>0) {
      p--;
      clearInterval(myInterval);
      picture._alpha = 0;
      picture.loadMovie(image[p], 1);
   }
}
function firstImage() {
   if (loaded == filesize) {
      picture._alpha = 0;
      picture.loadMovie(image[0], 1);
      slideshow();
   }
}
function lastImage() {
   if (loaded == filesize) {
      picture._alpha = 0;
      picture.loadMovie(image[total-1], 1);
      slideshow();
   }
}
function randomImage() {
   if (loaded == filesize) {
      picture._alpha = 0;
      picture.loadMovie(image[random(total)], 1);
   }
   slideshow();
}

function slideshow() {
   myInterval = setInterval(pause_slideshow, delay);
}
function pause_slideshow() {
   clearInterval(myInterval);
   if (p == (total-1)) {
      p = 0;
      firstImage();
   } else {
      nextImage();
   }
}

View Replies !    View Related
Random Images Slideshow
i used the flash mx samples file for a pictures slideshow...it works based on 2 buttons (back and fwd)...and on a text field you can type the number of the picture you want to see.

what i want to do is an automatic slideshow...from the beginning to the end going through all the pics...

the pics are loaded from a folder...they are not in the flash file library

View Replies !    View Related
Random Loading SlideShow
I'm creating a movie with a randomly loading slide show. The movie has 4 sets of 5 slides each that will randomly load everytime the page refreshs or that the site is revisited.
I am also tring to insert a menu on top of that slide show..
Does anyone know how this would be accomplished?

View Replies !    View Related
Random Slideshow - No Repeats
Hi People,

I am new to actionscript, but I am fast realising I need to do some serious study to get the hang of all this! I found this slideshow source at www.whatdoiknow.org, and it works perfectly, except that when the slides are set in random (not sequential) they repeat one or two before all the images in the array are shown. Is it possible to make it so that all the images are shown once before there are any repeats?
I would be very grateful for any help you guys can offer! I have attached the fla.
Here is the code:
code:
// **************************
// Crossfading slide show
// Author: Todd Dominey
// http://whatdoiknow.org
// http://domineydesign.com
// **************************
// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;
// parent container
var container_mc = this.createEmptyMovieClip("container", 0);
// movie clip containers
container_mc.createEmptyMovieClip("loader1_mc", 2);
container_mc.createEmptyMovieClip("loader2_mc", 1);
// preload watcher
this.createEmptyMovieClip("watcher_mc", 100);
// load xml
images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = parse;
images_xml.load("images.xml");
function parse(success) {
if (success) {
imageArray = new Array();
var root = this.firstChild;
_global.numPause = Number(this.firstChild.attributes.timer*1000);
_global.order = this.firstChild.attributes.order;
_global.looping = this.firstChild.attributes.looping;
_global.fadetime = Number(this.firstChild.attributes.fadetime);
_global.xpos = Number(this.firstChild.attributes.xpos);
_global.ypos = Number(this.firstChild.attributes.ypos);
var imageNode = root.lastChild;
var s = 0;
while (imageNode.nodeName != null) {
imageData = new Object();
imageData.path = imageNode.attributes.path;
imageArray[s] = imageData;
imageNode = imageNode.previousSibling;
s++;
}
// place parent container
container_mc._x = _global.xpos;
container_mc._y = _global.ypos;
// parse array
imageArray.reverse();
imageGen(imageArray);
} else {
trace("problem");
}
}
// depth swapping
function swapPlace(clip, num) {
eval(clip).swapDepths(eval("container_mc.loader"+n um+"_mc"));
}
function loadImages(data, num) {
if (i == undefined || i == 2) {
i = 2;
createLoader(i, data, num);
i = 1;
} else if (i == 1) {
createLoader(i, data, num);
i = 2;
}
}
function createLoader(i, data, num) {
thisLoader = eval("container_mc.loader"+i+"_mc");
thisLoader._alpha = 0;
thisLoader.loadMovie(data[num].path);
watcher_mc.onEnterFrame = function() {
var picLoaded = thisLoader.getBytesLoaded();
var picBytes = thisLoader.getBytesTotal();
if (isNaN(picBytes) || picBytes<4) {
return;
}
if (picLoaded/picBytes>=1) {
swapPlace("container_mc.loader2_mc", 1);
thisLoader.alpha(_global.fadeTime, 100);
timerInterval = setInterval(imageGen, _global.numPause, data);
delete this.onEnterFrame;
}
};
}
function imageGen(data) {
// random, or sequential?
if (_global.order == "random") {
// choose random # between 0 and total number of images
while (randomNum == randomNumLast) {
randomNum = Math.floor(Math.random()*data.length);
trace(randomNum);
}
loadImages(data, randomNum);
randomNumLast = randomNum;
} else if (_global.order == "random") {
// start at 0, increment to total number of images, then drop back to zero when done
if (p == undefined || p == data.length && _global.looping == "yes") {
p = 0;
} else {
break;
}
loadImages(data, p);
p++;
} else {
trace("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
}
clearInterval(timerInterval);
}
stop();

View Replies !    View Related
Random Slideshow Troubles
I am using MX 2004 and having trouble with a banner. I want to randomly load .jpg's from a file - pausing for 5 sec on each pic. I can get one .jpg to load, but it stops after one. Here's is the codes:

var numArray = ["randomPics/01.jpg",
"randomPics/02.jpg",
"randomPics/03.jpg",
"randomPics/04.jpg",
"randomPics/05.jpg",
"randomPics/06.jpg",
"randomPics/07.jpg",
"randomPics/08.jpg",
"randomPics/09.jpg",
"randomPics/10.jpg"];

this.createEmptyMovieClip("clip_mc", 2);


function changePic(){
numPic = random(numArray.length);
_root.loadMovie(numArray[numPic], "clip_mc");
}


this.onEnterFrame = function(){
setInterval(changePic, 5000);
}

View Replies !    View Related
Random Slideshow Tutorials
does anyone know where i can find a tutorial for 'random slideshow', for flash mx 2004?

thanks in advance,
jgatienza

View Replies !    View Related
[F8] Script Help Random Slideshow
I am a relative newbie. I have an autoplay random image xml slideshow. The problem is, I don't want the images to repeat until all of them have been shown. I've see posts with some hints about this, something about "shuffle" but I don't know what script or where I should add or change it. Any direction would be greatly appreciated!!!!

Here's the script:
//: SETUP INITIAL VARIABLES
var oldVar = 0;// keep track of previous random number
var newVar = 0;// used to load the next image
var si = 0;// interval variable

//: GET XML
var my_xml = new XML();// create our xml object
my_xml.ignoreWhite = true;// tell object to ignore all the white space in the file
my_xml.onLoad = function (success) {// when load function is called, pass a temp variable
if (success) {// if the temp variable was passed; file was loaded

// now that the xml has loaded successfully
// lets setup our final variables

library = this.firstChild.childNodes;// get all the <jpg> nodes
maxVal = library.length;// max number of fotos

// now that we've retrieve our xml ...
delete my_xml;// delete our xml object
getImage();// load first image

} else {// if the temp variable was not passed; file was not loaded
desc_txt.text = 'Error: XML Not Loaded';// display an errorr message on your text field
}
}
my_xml.load('library.xml');

//: LOAD THE NEXT IAMGE
function getImage() {
newVar = Math.floor(Math.random() * maxVal);// get random number
if (newVar == oldVar) {// if number = old number..
getImage();// get a number
} else {// else
oldVar = newVar;// set old to new number
container_mc.loadMovie (library[newVar].firstChild.firstChild.nodeValue);// load the next image
container_mc._alpha = 0;// set its alpha to 0
this.onEnterFrame = function () {// create loop
if (container_mc._width > 0) {// check that the image has been loaded
container_mc._x = Stage.width / 2 - container_mc._width / 2;// center movieclips to stage
container_mc._y = Stage.height / 2 - container_mc._height / 2;// center movieclip to stage
container_mc.onEnterFrame = fadeIn;// start fading out
desc_txt.text = library[newVar].firstChild.nextSibling.firstChild.nodeValue;// display the images description
delete this.onEnterFrame;// delete loop
}
}
}
}

//: FADE IN THE CURRENT MOVIECLIP
function fadeIn () {
if (this._alpha <= 100) {// if the movieclips alpha is greater than 0
this._alpha += 5;// reduce alpha by 5
} else {// else
this._alpha = 100;// reduce alpha to 0
delete this.onEnterFrame;// delete handler
si = setInterval(fadeOut, 2000);// after 2 seconds, fade out the movieclip
}
}

//: FADE OUT THE CURRENT MOVIECLIP
function fadeOut () {
clearInterval(si);// clear the interval variable
container_mc.onEnterFrame = function() {// create loop to fade out
if (this._alpha >= 0) {// if the movieclips alpha is greater than 0
this._alpha -= 5;// reduce alpha by 5
} else {// else
this._alpha = 0;// reduce alpha to 0
delete this.onEnterFrame;// delete handler
getImage();// load the next image
}
}
}



Thanks again!

View Replies !    View Related
Random Image Slideshow
Hi, I have a project for this company that requires an image slideshow to show 46 images, with small fade cuts separating each image. The way I have set up now, is just spread out on the timeline, and a very simple movie clip. I showed it to the president today, and he wants me the images to be shown at random so that they are not at all in the same sequence every time a visitor views the main page. I've looked at several random number generators and various other randomizers, and nothing appears to be controlled by just time. I found one that works by loading a different image every time the page is refreshed, but what I am looking for is for a new image to appear through a simple fade transition every 45 frames. I know the solution might require some very redundant coding because of the number of images, but i'm willing to make the sacrifice. any help?

View Replies !    View Related
XML Random Slideshow W/Captions
Hello,

How would I modify this code to add captions to the images?


ActionScript Code:
new_mc = this.createEmptyMovieClip("mc1", 1);
old_mc = this.createEmptyMovieClip("mc2", 2);
myarray = [];
//stick names of your clips here
function shuffle() {
    return Math.floor(Math.random()*3)-1;
}
for (var i = 1; i<9; i++) {
    myarray.push(i+".jpg");
}
trace(myarray);
myarray.sort(shuffle);
trace(myarray);
var c = 0;
function loadSwf(clip) {
    clearInterval(mi);
    new_mc._alpha = 0;
    new_mc.swapDepths(old_mc);
    new_mc.loadMovie(clip);
    var ctrl = this.createEmptyMovieClip("ctrl", 3);
    c++;
    c %= myarray.length;
    ctrl.onEnterFrame = function() {
        if (new_mc._width) {
            old_mc._alpha -= 5;
            new_mc._alpha += 5;
            if (old_mc._alpha<=0 && new_mc._alpha>=100) {
                delete this.onEnterFrame;
                trace(new_mc.getDepth());
                var myvar = old_mc;
                old_mc = new_mc;
                new_mc = myvar;
                mi = setInterval(startoff, 5000);
            }
        }
    };
}
function startoff() {
    //put path to folder here
    loadSwf("http://www.domain.com/images/"+myarray[c]);
}
startoff();

View Replies !    View Related
XML Random Image Slideshow
I'm pulling my hair out trying to figure out how to make it pull the image and the text assiociated with the image randomly. Any direction would be greatly appreciated:









Attach Code

var id, current;
var k = 0, p = 0;
var slide = 1;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
id = setInterval(preloadPic, 100);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("assets/flash/splash/images.xml");
function Math.preloadPic()(Math.random()*5) {
clearInterval(id);
var con = picture.duplicateMovieClip("con"+k, 200+k);
con.loadMovie(image[p]);
_root.txt.desc_text_mov.desc_txt.text = description[p];

preloader._visible = 1;

con._alpha = 0;
var temp = picture.createEmptyMovieClip("temp"+k, 99+k);
k++;
temp.onEnterFrame = function() {
var total = con.getBytesTotal();
var loaded = con.getBytesLoaded();
percent = Math.round(loaded/total*100);
preloader.preload_bar._xscale = percent;
if (con._width) {
preloader._visible = 0;
con.onEnterFrame = fadeIn;
_root.txt.gotoAndPlay(2);
if (slide) {
id = setInterval(nextImage, 9000);
}
delete this.onEnterFrame;

}
};
}
MovieClip.prototype.fadeIn = function() {
if (this._alpha<100) {
current._alpha -= 10;
this._alpha += 10;
} else {
current._visible = 0;
current = this;
delete this.onEnterFrame;
}
};
function nextImage() {
current = this["con"+p];

p<total-1 ? p++ : p=0;
preloadPic();
}
function prevImage() {
current = this["con"+p];

p>0 ? p-- : p=total-1;

preloadPic();
}
preloadPic();

View Replies !    View Related
Random Loading Jpg's Xml Slideshow
hi everyone.
how can i make this slideshow http://www.kirupa.com/developer/mx20..._slideshow.htm to load the jpg's in random way ?

View Replies !    View Related
Random Image Slideshow
Hi all, i've been trying to work with this actionscript to make it random and i just can't seem to do it. Any direction would be greatly appreciated.


Code:
var id, current;
var k = 0, p = 0;
var slide = 1;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
id = setInterval(preloadPic, 100);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("assets/flash/splash/images.xml");
function Math.preloadPic()(Math.random()*5) {
clearInterval(id);
var con = picture.duplicateMovieClip("con"+k, 200+k);
con.loadMovie(image[p]);
_root.txt.desc_text_mov.desc_txt.text = description[p];

preloader._visible = 1;

con._alpha = 0;
var temp = picture.createEmptyMovieClip("temp"+k, 99+k);
k++;
temp.onEnterFrame = function() {
var total = con.getBytesTotal();
var loaded = con.getBytesLoaded();
percent = Math.round(loaded/total*100);
preloader.preload_bar._xscale = percent;
if (con._width) {
preloader._visible = 0;
con.onEnterFrame = fadeIn;
_root.txt.gotoAndPlay(2);
if (slide) {
id = setInterval(nextImage, 9000);
}
delete this.onEnterFrame;

}
};
}
MovieClip.prototype.fadeIn = function() {
if (this._alpha<100) {
current._alpha -= 10;
this._alpha += 10;
} else {
current._visible = 0;
current = this;
delete this.onEnterFrame;
}
};
function nextImage() {
current = this["con"+p];

p<total-1 ? p++ : p=0;
preloadPic();
}
function prevImage() {
current = this["con"+p];

p>0 ? p-- : p=total-1;

preloadPic();
}
preloadPic();

View Replies !    View Related
Random Slideshow Effect Help
Please help me to add an effect (fade in-out or else) on random image slideshow with code:

var picArray:Array = new Array();
picArray[0] = "images/0.jpg";
picArray[1] = "images/1.jpg";
picArray[2] = "images/2.jpg";
picArray[3] = "images/3.jpg";
picArray[4] = "images/4.jpg";
picArray[5] = "images/5.jpg";
picArray[6] = "images/6.jpg";
picArray[7] = "images/7.jpg";
picArray[8] = "images/8.jpg";
picArray[9] = "images/9.jpg";
picArray[10] = "images/10.jpg";
picArray[11] = "images/11.jpg";
picArray[12] = "images/12.jpg";
picArray[13] = "images/13.jpg";
picArray[14] = "images/14.jpg";
picArray[15] = "images/15.jpg";
picArray[16] = "images/16.jpg";
picArray[17] = "images/17.jpg";
picArray[18] = "images/18.jpg";
picArray[19] = "images/19.jpg";
picArray[20] = "images/20.jpg";
picArray[21] = "images/21.jpg";
picArray[22] = "images/22.jpg";
picArray[23] = "images/23.jpg";
var i = 0;
trace(picArray.length);
mi = setInterval(function () {
rndNum = Math.floor(Math.random()*picArray.length);
var clip = _root.attachMovie("pic", "pic"+i, i++);
loader.loadMovie(picArray[rndNum]);
trace("picArray.length= "+picArray.length+" picArray[rndNum] = "+picArray[rndNum]);
picArray.splice(rndNum, 1);
if (picArray.length == 0) {
clearInterval(mi);
}
}, 2000);


i have found something but I can't implement it to this code...

View Replies !    View Related
Random Slideshow, URL Problem
I've been working on this great slideshow from NoPonies and wanted to add a url link called from the xml to each images. I'm very close i'm sure but can anyone help me it's driving me crazy for two days now...

here's the as and the files are attached:

import flash.display.BitmapData;
import mx.utils.Delegate;
import gs.TweenLite;

class simpleSlideCaptions extends MovieClip {
//vars for XML
private var slideImage:XML;
public var bgImages:Array;
public var captionsArray:Array;
private var p:Number = 0;//track pos in arrays
//Variables pulled in from XML
private var crossFadeTime:Number;
private var imageTime:Number;
private var order:String;
private var captions:Boolean;
private var persistentCaptions:Boolean;
//empty mcs
public var holder_mc:MovieClip;
//set interval
private var bitmapFadeInterval:Number=0
//movieClip Loader
private var slideLoader:MovieClipLoader;
//textField Holder MC
private var captionsHolder:MovieClip;
//textField
private var captionsText:TextField;
//url
private var link:String;
//XML loc
private var xmlData:String;
//random image tracker
private var randomImg:Number;
//text array tracker
private var textInc:Number = 0
/******************************************
TEXTFIELD SPECIFIC VARS
******************************************/
//textField Padding, left and right indent from edge of image
private var captionsPadding:Number = 75;
//textField BG Colour
private var textFieldBgColour:Number = 0x000000;
//textField Bg Alpha
private var textFieldBgAlpha:Number = 100;
//textField Colour
private var textColour:Number = 0xFFFFFF;
//textField Font
private var textFieldFont:String = "PF_Ronda_Seven_Bold";//font, embedded in library, set to export for actionScript
//textField Text Size
private var textFieldFontSize:Number = 11;
//textField Use Embedded Fonts
private var textFieldUseEmbedded:Boolean = true;//use if using embedded fonts

//passed via constructor argument, is the location movieClip you want the slideshow to appear in
private var slideTarget_mc:MovieClip;

/*****************************************/

function simpleSlideCaptions(slideTargets:MovieClip, xmlData:String) {
//grab a reference to the class instance for use in the XML parsing routine
var thisObj:simpleSlideCaptions = this;
slideTarget_mc = slideTargets;
this.xmlData = xmlData;

//movieClip loader
slideLoader = new MovieClipLoader();
slideLoader.addListener(this);//give the scope of this class instance

var slideImage:XML = new XML();
slideImage.ignoreWhite = true;
slideImage.onLoad = function(success:Boolean) {
if (success) {
thisObj.slideImage = this;
//get vars from XML file
thisObj.crossFadeTime = this.firstChild.attributes.crossFadeTime;
thisObj.imageTime = this.firstChild.attributes.imageTime;
thisObj.imageTime = (1000*60)*thisObj.imageTime;
thisObj.order = String(this.firstChild.attributes.order);
thisObj.captions = Boolean(parseInt(this.firstChild.attributes.captio ns));//cast as boolean
thisObj.persistentCaptions = Boolean(parseInt(this.firstChild.attributes.persis tentCaptions));//cast as boolean
thisObj.p = 0;
thisObj.bgImages = [];//reset the array var, should for some reason you want to load in a different set of images
thisObj.captionsArray = [];
var xmlNodes = this.firstChild;
var largeImages = xmlNodes.childNodes.length;
var i = 0;
for (i=0; i<largeImages; i++) {
thisObj.bgImages[i] = xmlNodes.childNodes[i].childNodes[0].firstChild.nodeValue;
if (thisObj.captions == 1) {
thisObj.captionsArray[i] = xmlNodes.childNodes[i].childNodes[1].firstChild.nodeValue;
}
link[i] = xmlNodes.childNodes[i].childNodes[2].firstChild.nodeValue;
}
//load random image when we successfully parse XML
//note reference to class instance
thisObj.init();
} else {
trace("Fatal Error - Loading slideshow images XML failed");
}
};
//lets load the XML file
slideImage.load(xmlData);
}
//second constructor function, here we create our empty mc, set up the movieClipLoaders and finally call the loadSlides function
private function init() {
//we have xml content, so lets start the image loading.
holder_mc = slideTarget_mc.createEmptyMovieClip("holder_mc", 1);
holder_mc._x = 0;
holder_mc._y = 0;
//create the captions if we want them
if (captions) {
//create captions text text field, empty mc and background MC
captionsHolder = holder_mc.createEmptyMovieClip("captionsHolder", 3);
captionsHolder.createEmptyMovieClip("captionsHolde rBg",1);
//draw the bg mc's fill
captionsHolder.captionsHolderBg.beginFill(textFiel dBgColour,textFieldBgAlpha);//fill colour, and alpha value set here!
captionsHolder.captionsHolderBg.moveTo(0,0);
captionsHolder.captionsHolderBg.lineTo(10,0);
captionsHolder.captionsHolderBg.lineTo(10,10);
captionsHolder.captionsHolderBg.lineTo(0,10);
captionsHolder.captionsHolderBg.lineTo(0,0);
captionsHolder.captionsHolderBg.endFill();

//create the captions text field
captionsHolder.createTextField("captionsText",2,0, 0,0,0);//all zeros, we set its width etc later.
//text format
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = textFieldFont;//font
my_fmt.size = textFieldFontSize;//size
my_fmt.color = textColour;//text colour
my_fmt.align = "justify";
//text field properties
captionsHolder.captionsText.embedFonts = textFieldUseEmbedded;
captionsHolder.captionsText.autoSize = "left";
captionsHolder.captionsText.wordWrap = true;
captionsHolder.captionsText.html = true;
captionsHolder.captionsText.setNewTextFormat(my_fm t);

//add mouse event listeners if we want captions and they are set to not be persistent
//be aware that links in captions text will fail to work if you turn on the rollovers.
if (!persistentCaptions) {
//use delegate to scope functions
this.holder_mc.onRollOver = Delegate.create(this, imageOverHandler);
this.holder_mc.onRollOut = Delegate.create(this, imageOffHandler);
this.holder_mc.onRelease = Delegate.create(this, imagePressHandler);

}
//set the captions to have a 0 alpha, tweened in later
captionsHolder._alpha = 0;
}
//load the slide
loadSlides();
}
//captions function. Loads, resizes and tweens in the captions text
private function imageOverHandler() {

captionsHolder.captionsText._x = holder_mc._x+captionsPadding;//place text field, we only use x, as we adjust the parent mc's y value.
captionsHolder.captionsText._width = holder_mc._width-(captionsPadding*2);//size text field with some padding
captionsHolder.captionsText.htmlText = captionsArray[textInc];//populate text field
captionsHolder.captionsHolderBg._width = holder_mc._width;//size bg clip
captionsHolder.captionsHolderBg._height = captionsHolder.captionsText._height+5;//size bg clip with some padding
captionsHolder._y = (holder_mc._y+holder_mc._height-captionsHolder.captionsHolderBg._height)-225;//bottom align text//adjust here if needed pos of text
TweenLite.to(captionsHolder,1,{_alpha:100});

}
//captions removal function, tweens text to 0 alpha and removes its content.
private function imageOffHandler() {
TweenLite.to(captionsHolder,1,{_alpha:0, onComplete:emptyText, onCompleteParams:[this]});
function emptyText(ref) {
ref.captionsHolder.captionsText.htmlText = "";
ref.captionsHolder._y = 0;//reset y of captions
}
}

private function imagePressHandler() {
getURL(link[p], "_self");
}

private function onLoadProgress(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
//amountLoaded = Math.floor((bytesLoaded/bytesTotal)*100);//calulate a loading percentage!
//do something with this data if you want
}
//run when we have image data

private function onLoadInit(target:MovieClip):Void {
/*remove the captions text, if we have it enabled. Check to see if the cursor is on the image, if it is run this function.
means that we can have a situation where the captions are set to display on mouseOver, but the image swaps, leaving old captions
because the mouse has not moved off the image to retrigger the captions functions. We also just don't want to call this function
all the time either, as we would have a situation where we have enabled mouseOver captions, but they would show up, even if the mouse
was not over the image*/
if (captions && persistentCaptions || captions && holder_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
imageOffHandler();
}
//clear the existing interval
clearInterval(this.bitmapFadeInterval);
//alpha out our image we load our bitmap into
target._alpha = 0;
//create the bitmap object, each time this is reset, keeping memory footprint fairly low..
var bitmap:BitmapData = new BitmapData(target._width, target._height, true);
//draw the bitmap
bitmap.draw(target);
//fade in the temp mc
TweenLite.to(target,this.crossFadeTime,{_alpha:100 , onComplete:onFinishTween, onCompleteParams:[this]});//pass reference to class
//as "this" refers to the tween object itself when called from the tween onComplete handler...
function onFinishTween(ref) {
//attach our loaded bitmap to our background mc when the temp totally obscures it
ref.holder_mc.attachBitmap(bitmap,0,"auto",true);
//fade the temp back to 0
TweenLite.to(target,.1,{_alpha:0, onComplete:clearTween});
//tween in the captions text. See above description for rationale.
if (ref.captions && ref.persistentCaptions || ref.captions && ref.holder_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
ref.imageOverHandler();
}
function clearTween() {
//remove the temp mc
removeMovieClip(ref.holder_mc.bg_loader);
}
//reset the timer
//increment manual click var
ref.beginInterval();
}



}
private function beginInterval():Void {
this.bitmapFadeInterval = setInterval(this, "loadSlides", imageTime);
}
/*Load the slides.*/

private function loadSlides() {
if (order == "random") {
//create the temp loader mc that we load our new image into
holder_mc.createEmptyMovieClip("bg_loader",2);
getUniqueNum();
} else {
//sequential loading of images
holder_mc.createEmptyMovieClip("bg_loader",2);
slideLoader.loadClip(bgImages[p],holder_mc.bg_loader);
textInc = p
p++;
if (p == bgImages.length) {
p = 0;
}

}
}
//generate a unique number, no immediate duplicates in random slide shows
private function getUniqueNum() {
var tempRandomImg = Math.floor(Math.random(bgImages.length)*bgImages.l ength);
if (tempRandomImg == randomImg &&bgImages.length>1 ) {
getUniqueNum();
} else {
randomImg = p = textInc = tempRandomImg;
slideLoader.loadClip(bgImages[randomImg],holder_mc.bg_loader);
}
}
//kill the interval functions
public function killInterval() {
clearInterval(bitmapFadeInterval);
bitmapFadeInterval = null
}


}


Thanks in advance.

View Replies !    View Related
Random Image On Slideshow
hii

periority(High)
can anybody help me to find out the issue which coming with PNG files on slideshow the fading in & OUT IS NOT SMOOTH. WITH JPG ITS WORKING FINE

for testing just paste this code on ur 1st frame & test it,

2nd periority(low)
in this i need Random image in this Slideshow write now its coming in seqential order.
can anybody help me in that,what will be the code for that ?
or
suppose if i load these images through flashvars,can i load random image on each refresh. is it possible?

//AS-2 started
// put the image name here
photos = "1.png,2.png,3.png,4.png,5.png,6.png";

interval = "6";
_root.checkthisroot = true;
if (checkthisroot) {
Stage.scaleMode = "noScale";
Stage.align = "TL";
}
if (defaultinterval == undefined) {
defaultinterval = 6;
} else {
defaultinterval = Number(defaultinterval);
}
if (folder == undefined) {
folder = "";
}
checkslash = function () {
if (folder.length>0) {
if (folder.charAt(folder.length-1) != "/") {
folder += "/";
}
}
};
checkslash();
if (datafile == undefined) {
datafile = "inherit";
}
if (alphadelay == undefined) {
alphadelay = 7;
} else {
alphadelay = Number(alphadelay);
}
if (loop == undefined) {
loop = true;
} else {
if (loop == "true") {
loop = true;
} else {
loop = false;
}
}
if (clicktoreplay == undefined) {
clicktoreplay = true;
} else {
if (clicktoreplay == "true") {
clicktoreplay = true;
} else {
clicktoreplay = false;
}
}
i = 0;
photoindex = -1;
showimage = true;
nextimageloaded = false;
waiting = false;
checkvars = function () {
if (photos == undefined) {
getlist();
} else {
myphotos = photos.split(",");
myinterval = interval.split(",");
slide();
}
};
getlist = function () {
myvars = new LoadVars();
myvars.onLoad = function(success) {
if (success) {
myphotos = this.photos.split(",");
myinterval = this.interval.split(",");
if (this.defaultinterval != undefined) {
defaultinterval = Number(this.defaultinterval);
}
if (this.folder != undefined) {
folder = this.folder;
}
checkslash();
if (this.alphadelay != undefined) {
alphadelay = Number(this.alphadelay);
}
if (this.loop != undefined) {
if (this.loop == "true") {
loop = true;
} else {
loop = false;
}
}
if (this.clicktoreplay != undefined) {
if (this.clicktoreplay == "true") {
clicktoreplay = true;
} else {
clicktoreplay = false;
}
}
slide();
} else {
trace("unsuccess");
}
};
/*if (datafile == "inherit") {
datafile = this._url.substr(0, _url.length-3)+"txt";
}
trace(datafile);
myvars.load(datafile);*/
};
slide = function () {
i++;
photoindex++;
if (photoindex == myphotos.length) {
photoindex = 0;
}
var p = createEmptyMovieClip("photo"+i, i);
p.createEmptyMovieClip("internal",1);
loadMovie(folder+myphotos[photoindex], p.internal);
p._alpha = 0;
this.onEnterFrame = function() {
var l = p.internal.getBytesLoaded();
var t = p.internal.getBytesTotal();
if (l == t) {
preloader._visible = false;
delete this.onEnterFrame;
checkshow();
}
};
};

MovieClip.prototype.mfade = function() {
this.a = this._alpha;
this.onEnterFrame = function() {
this.a += (100-this.a)/alphadelay*2;
this._alpha = Math.round(this.a*1);
if (100-this.a<2) {
this.interval._alpha -= mytime;
delete this.onEnterFrame;
this.myinterval._alpha = 100;
this._alpha = 100;//dikai dene ke baad alpha
this._parent["photo"+(i-2)].mfadeOut.MovieClip();
}
};
};
//---------------------------------------
MovieClip.prototype.mfadeOut = function() {
this.b = this._alpha;
this.onEnterFrame = function() {
this.b += (0-this.b)/alphadelay;
this._alpha = Math.round(this.b);
if (0-this.b<2) {
//delete this.FadeOut.onEnterFrame;
this.myinterval._alpha = alphadelay;
this._alpha = 0;//dikai dene ke baad alpha
this._parent["photo"+(i-2)].removeMovieClip();
}
};
};
//------------------------------
checkshow = function () {
if (showimage || waiting) {
showimage = false;
waiting = false;
this["photo"+i].mfade();
if (myinterval[photoindex] != undefined) {
mytime = Number(myinterval[photoindex])*1000;
} else {
mytime = Number(defaultinterval)*1000;
}
mycounter = setInterval(counter, mytime);
if (photoindex<(myphotos.length-1) || loop) {
slide();
} else if (clicktoreplay) {
this["photo"+i].onPress = function() {
slide();
};
}
} else {
nextimageloaded = true;
this["photo"+i].mfadeOut();
}
};
counter = function () {
clearInterval(mycounter);
if (nextimageloaded) {
nextimageloaded = false;
showimage = true;
checkshow();
} else {
waiting = false;
}
};
checkvars();
stop();

//AS-2 ENDED

thanks
neeraj

View Replies !    View Related
XML Random Images Slideshow
I've created a flash slideshow with a fade-in fade-out effect that pulls a random image from a file containing a bunch of images from an XML file. This tutorial helped me out a lot.

http://www.webzo.org/tutorials/flash...-slideshow.php

Now what I'm trying to do is create some type of array that would generate those random images but maybe only 10 or so and just play those 10 images so that there aren't any duplicates one after another from pulling a random image from the file every time. Anyway, If anyone knows how this could be done preferably by modifying the code in the above tutorial, that would be awesome.

View Replies !    View Related
Random Slideshow But With SWF Files
I'd like to create a slideshow (but with swf files) and have it randomly pick which one will play next once the first one is done - and just have it continously running - and load the swf files into a mc externally.

I hope that makes sense... I'm new to this - so any suggestions, tutorials, or eved actionscript is much appreciated. Thanks.

View Replies !    View Related
XML Driven Random Slideshow.
Hi I am new to these forums and to Flash as well, pretty much. This seems to be about the best online community for flash that I have found. This is a great community. I did the Carousel tut, it was a great tutorial and Lee makes everything so easy to understand and grasp. I really like the concept of things being controlled by xml. I am currently working on a project where I would like to have an area where photos randomly fade in, stay for maybe 4 or 5 seconds and fade out to be replaced by a new one. I need no controls, but I would like the flash to call the photos and a caption from the xml file. I have the xml file and an idea of how it should go, but I seem to be stuck at the starting gate. Maybe some of you could offer some insight. I hope this is possible and that it makes sense to all of you. Thanks in advance for all your help.

Noods-
http://www.danhigbie.com

View Replies !    View Related
Random Image In XML Slideshow
I have a (very) basic XML slideshow. The slideshow appears on every page of a 7-page site. Is there a simple way to make the starting picture different on each of the 7 pages, without creating 7 different swfs & xml docs...?

I'm thinking some sort of onLoad get random image, then increment by +1...but if the random image was the seventh of eight images, how would I script it to loop to the beginning six...?

Probably basic, probably been asked before...please just point me in the right direction if this is a redundant question. (I did search first, but didn't find anything...)

Thanks for your time!!

View Replies !    View Related
SWF/movieclip Random Timed Slideshow
Basically I need help creating a slideshow that loads .swf or movieclip files, randomly and for a small period of time (i.e. 10-15 seconds) then changes. Also be able to have back and forward buttons. You can e-mail me at nabilkazerouni@yahoo.com

View Replies !    View Related
Simple Random Slideshow From Folder ?
Hi I am trying to find any good script how to make random slideshow from .jpg pictures in external folder ?

So I need these functions:

- pictures from external folder
- random order
- transition (not necessary)


I donīt need any buttons, components, just actionscript based simple automatic random slideshow from pictures I put into external folder.

Unfortunately I am not programmer, does anybody know solutions ?

Thanx in advance
P.

View Replies !    View Related
Random Loading Text From XML Slideshow
Hi!

I'm trying to load text into a dynamic text box from an external XML. My XML "test.XML" looks like this:


HTML Code:
<?xml version="1.0" standalone="yes"?>
<root>
<item>
<author>Namer Last</author>
<content>Blah bla bla bla bla bla.</content>
</item>
</root>
And I have two dynamic text boxes on my stage; one named "author_txt" the other named "content_txt"

Here is AS:

ActionScript Code:
var xmlFlash_xml:XML = new XML();
xmlFlash_xml.ignoreWhite = true;
xmlFlash_xml.onLoad = doit();

function doit(success) {
    //onLoad event is triggered when the XML document hasbeen entirely loaded
    if (success) {
        trace('success');
        // success is true if the XMl has been loaded with no errors, and false else
        var l = this.firstChild.childNodes.length;
        // firstChild property represents the rootnode of the XML document, childNodes property returns an array containing the children nodes of the current node. So, l variable holds the number of children of the root node
        var c = Math.floor(Math.random()*l);
        author_txt.text = this.firstChild.childNodes[c].childNodes[0].childNodes[0].nodeValue;
        content_txt.text = this.firstChild.childNodes[c].childNodes[1].childNodes[0].nodeValue;
    }
    else {
        trace("fail");
    }
};
xmlFlash_xml.load("test.xml");

It fails to load. Any idea why?

Thanks!

View Replies !    View Related
Random Movie Slideshow - So Close But Yet So Far...
Hi,

I have a library of about 70 movie clips of company logos that fade in and fade out...I wanted to make a sort of 'random slideshow' of all the move clips, so I went ahead and copied the actionscript code for a timer that would (ideally) delay the time that it takes for the next clip to load.

Problem is, the timer starts up first thing rather than after a clip has played, and the clips then play at the same time.

The actionscript is on frame one of the Flash movie (there are about 70 clips, for the example I'm working on I'm just using 3 to start with):

stop();
function wait() {
for (i=25; i<=27 {
_root.attachMovie("my"+i+"_clip","new"+i+"clip", i);
clearInterval(myTimer);
i++;
}
}

myTimer = setInterval(wait, 4000);


Are there any suggestions?

View Replies !    View Related
Need Random Functionality For An Existing XML Slideshow
Hello,

I was using Emre Biberoglu's excellent slideshow as a base for a slideshow. Worked absolutely great, until my client asked for the slideshow to display the images in random order.

The untouched source is here:
http://www.biberoglu.com/flash/xmlslide/xmlslide.zip

I tried modifying the values that define the current image to something like: (Math.floor(Math.random() * nodeCount); to generate a random number as it is a common technique which worked well for me in the past.

The code is pretty clean, but for some reason, every attempt I made, the image number displayed doesn't match the image shown.

So... just a random function that works, if anybody wants to give it a try.

Cheers

View Replies !    View Related
Random Movie Slideshow - So Close But Yet So Far...
Hi,

I have a library of about 70 movie clips of company logos that fade in and fade out...I wanted to make a sort of 'random slideshow' of all the move clips, so I went ahead and copied the actionscript code for a timer that would (ideally) delay the time that it takes for the next clip to load.

Problem is, the timer starts up first thing rather than after a clip has played, and the clips then play at the same time.

The actionscript is on frame one of the Flash movie (there are about 70 clips, for the example I'm working on I'm just using 3 to start with):

stop();
function wait() {
for (i=25; i<=27 {
_root.attachMovie("my"+i+"_clip","new"+i+"clip", i);
clearInterval(myTimer);
i++;
}
}

myTimer = setInterval(wait, 4000);


Are there any suggestions?

View Replies !    View Related
Does Anyone Know Of Any Good Random Slideshow Scripts For Flash5?
Hi,

I want to create a slide show of my photographs. I need a script that would import photos randomly every 2 seconds to the main stage from an external folder [photos].
Also when you roll over the current photo it pauses the movie untill you rollout and shows a quick description.

Anyone have any ideas how to do this?

I did try one script that imported single .swf's randomly but there were loading problems on machines with modems and the fotos never appeared.

(There are 200+ fotos, about 15-20k each).

Thanks for your help.

View Replies !    View Related
Does Anyone Know Of Any Good Random Slideshow Scripts For Flash5?
Hi,

I want to create a slide show of my photographs. I need a script that would import photos randomly every 2 seconds to the main stage from an external folder [photos].
Also when you roll over the current photo it pauses the movie untill you rollout and shows a quick description.

Anyone have any ideas how to do this?

I did try one script that imported single .swf's randomly but there were loading problems on machines with modems and the fotos never appeared.

(There are 200+ fotos, about 15-20k each).

Thanks for your help.

View Replies !    View Related
XML Random Image Slideshow W/ Crossfades - URL Button Problem
This is the great slideshow from Noponies and I wanted to add a url link by XML to the whole image. I'm pretty close by now but I just can't seem to link it to the xml. Please Help!

View Replies !    View Related
Flash 8 Random Sound, Random Movieclip
Dear people, happy greetings to you all.

I would like to find some way of using a simple variable structure to do 2 things:
Pick and play a random sound from say - a selection of 5 sound files.
Do something similar with movieclips.

If you could show me where some relevant tutorials are that show how to do this or can supply some indicative code I would be most grateful.

many thanks
julie
*

View Replies !    View Related
Photo Slideshow With XML - Image Gap On First Cylce Through Slideshow
Hello,

I am new to this site, and I went through the tutorial on this site, "Photo slideshow using XMl and Flash, " http://www.kirupa.com/developer/mx20..._slideshow.htm
but I encountered a problem where my images lag the first time they cycle through all the images in the XML file.

The first time the flash page loads and starts the slideshow, I don't want the gap between the transitioning of the images where the movie backgound shows. I think it has something to do with the images loading for the first time, so I tried to load each picture in a different movieclip with an alpha of 0 before the slideshows starts, but it didn't work and there is still the gap between the images the first time the pictures cycle through the slide show.

Please offer any advice on how to stop the image lag the first time the slideshow cycle through all the images in the XML file.

View Replies !    View Related
Random Flash N Random Image
Basically I have 5 flash movies and 3 images and I want to show them randomly using dreamweaver.. anybody knows how to do it?

View Replies !    View Related
Flash Slideshow
Hi,

could anyone explain me or give me a tut on how to do a slidshow in flash. I would like thumbnails as buttons and the pics slide in between. For instance I see Pic 1 and want to go to pic 5, I would like to see 2,3 and 4 slide by

thx

View Replies !    View Related
Slideshow In Flash
I need help to figure out the best way to make a slideshow in flash. I have about 10 pictures and would like to display them in flash so that the user could click to go to the next picture. What would be the best way to do this?
Thanks

View Replies !    View Related
Flash Slideshow Help
Hello! Does anyone know of a program or an easy way to create a flash slideshow with a drag and drop menu format? The basics are as follows:
1-presenter sees the full breakdown of slides on a menu
2-presenter selects slides to be played at designated order, drags and drops to an area
3-slideshow plays with slides presenter chooses
Any help at all would be greatly appreciated. And other alternatives to give the same effect as well. Thank you Thank you Thank you!!!

Presres

View Replies !    View Related
Flash MX Slideshow
hi

like everyone else im bored of power point i want to make a slideshow using the slide presentation feature is Flash MX. how do i manage to set it up automacticaly (change slides every minute)? can someone please help or offer a tutorial

Thanx

View Replies !    View Related
Help With Slideshow In Flash 8.
Hello, one and all
I am new to this community and am posting because I hope you can help me!

I have followed the tutorial called Flash and XML here: http://www.gotoandlearn.com/ on making a slideshow in Flash reading the data (pictures and captions etc) from an XML file, that works fine. What I now want to do is change which slideshow (of a number of different ones, stored in different XML files) is displayed in the "holder" movieclip by clicking on different buttons.

I.e = Click button 1 - Slide show 1 displayed
Click button 2 - Slide show 2 displayed

I thought this would simply be a case of loading in different XML files into my XML variable using the XML.load("") command.

This doesn't seem to work instead of slideshow one replacing slide show 2 I seemingly end up with one longer slideshow with pictures from 1 and 2.

I have tried so many ways of trying to fix this:
Separating the different slideshows to different XML variables and loading each in.
Loading in a Blank XMl document between the changes.
Using the unLoadMovie command on the holder between each change.

None of which have worked I still end up with the same issue. It seems flash has some kind of permenant memory for whats been loaded into the holder Movie clip and I can't seem to blank it and load something new.

Please note I am very new to Flash and still trying to find my feet.
Thanks.

View Replies !    View Related
Flash Slideshow
I'm trying to find some code or something I can excerpt to basically do a flash slide show that looks something like this...

http://profile.myspace.com/index.cfm...dID=985 91593

The middle of the page with all the stills from the film...



I have about 40 jpgs hosted on my site, I'd like to know how I can take those pics and using some flash slideshow plugin make them fade in and out over a period of time. Where can I find such a thing? You see it on the web all the time it seems. Something easy to use where I can just put in the link to the file. Where can I find something easy to use like this?

View Replies !    View Related
[CS3] Flash Slideshow Help
Hey

i have a problem:
i made this slideshow thing with a tutorial from this site:http://www.layersmagazine.com/flash-...e-gallery.html

and when i publish it its says 1120: Access of undefined property next_btn. last_btn.onPress=function(){

heres the file i made:

View Replies !    View Related
[CS3] Flash Slideshow
Hello Everybody!

I'm finishing my slideshow in Flash CS3. I have created two buttons and give it an action scripts but it does not work. For exmaple, below are my action scripts for my flash slideshow. Below are my action scripts.

stop();
//next button
next_btn.onPress=function(){
if(mc_content._currentframe==mc_content._totalfram es){
mc_content.gotoAndStop(1)
}else{
mc_content.nextFrame()
}
}

//last button
last_btn.onPress=function(){
if(mc_content._currentframe==1){
mc_content.gotoAndStop(mc_content._totalframes)
}else{
mc_content.prevFrame()
}
}

PS: It does not work! I desparetely need your help. I have upload my flash file for you to see as well. Please help me out. What did I missed in the scripts? Thank you in advanced.

Upload link:
http://www.megaupload.com/?d=0ZHV9DVP

Vince :-)

View Replies !    View Related
Flash Slideshow Help
I was able to figure out how to control the fade in code for the images in this slideshow script but I can't figure out how to do a fade out. Any help would be very appreciated.

Thanks!

Here's the code:


delay = 5000;
//-----------------------
function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;

}
firstImage();

} else {

content = "file not loaded!";

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {

if (Key.getCode() == Key.LEFT) {

prevImage();

} else if (Key.getCode() == Key.RIGHT) {

nextImage();

}

};
p = 0;
this.onEnterFrame = function() {

filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {

preloader.preload_bar._xscale = 100*loaded/filesize;

} else {

preloader._visible = false;
if (picture._alpha<100) {

picture._alpha += 10;

}

}

};
function nextImage() {

if (p<(total-1)) {

p++;
if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();

}

}

}
function prevImage() {

if (p>0) {

p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();

}

}
function firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
slideshow();

}

}
function picture_num() {

current_pos = p+1;
pos_txt.text = current_pos+" / "+total;

}
function slideshow() {

myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {

clearInterval(myInterval);
if (p == (total-1)) {

p = 0;
firstImage();

} else {

nextImage();

}

}

}

View Replies !    View Related
Flash Slideshow App
I am creating a Flash application where a user can upload their photos and create a slideshow. My question is: How would I go about allowing the user to publish their slideshow into an swf (or other format) when they are finished?

Here is an example of what I want to do. In this example, the user can click publish and their slideshow is converted into an swf:

http://www.slideroll.com

View Replies !    View Related
Flash Mx And Xml Slideshow
anyboby familiar with flash mx and xml slideshow???

i got my hand on a simple slideshow that suit my need for a customer website.
the thing is i have landscape and portrait pictures.
when it loads the landscape are centered since it's the size of the .swf file but the portrait ones are on the left.
how can center them?
i am pretty sure it has to do with this part of the code but i can not figure it out

ActionScript Code:
container_mc._x = _global.xpos;
        container_mc._y = _global.ypos;

any help would be appricated

View Replies !    View Related
Flash Slideshow
hello boy's/girl's i followed a tutorial on www.gotoandlearn.com, about a scrolling thumbnailpanel, I made it a mouse sensetive slideshow. How futher you drag the mouse from the center, how faster it's move to that direction, ("left/right"). The problem is if you drag out your mouse of the slideshow, it's still moving with the same speed, to the side it was scrolling. when you dragged out your mouse.

What i want is that if you drag out your mouse, that the slideshow loosing his speed, and after like 3 pictures slowly stops, and not if you drag out your mouse, that the slideshow immediatly stop's.

here is the code, i hope some of you can help me??


ActionScript Code:
stop();

slideshow.onRollOver = slideshowOver;

function slideshowOver() {
    this.onEnterFrame = scrollSlideshow;
    delete this.onRollOver;
}

var b = stroke.getBounds(_root);

function scrollSlideshow() {
        if(_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
        this.onRollOver = slideshowOver;
        delete this.onEnterFrame;
    }
   
    if(slideshow._x >= -40) {
        slideshow._x = -40;
    }
   
    if(slideshow._x <= -2230) {
        slideshow._x = -2230;
    }
   
    var xdist = _xmouse - 310
   
    slideshow._x += -xdist / 6;
}

plz help me

View Replies !    View Related
Slideshow: Flash Between Pix
i have a very simple slideshow controled through xml and actionscript ... but between the images i have an anoying flash every time ... even when the pix are loaded!

check out an example

frame-eleven.com/newyork/dummy

and heres the script:

slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);

}
}
//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
loadMovie(imagePath, targetClip);
}
//
// Event handler for 'Next slide'


setInterval(next,3000);

function next() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
currentIndex = 1;
currentIndex++;
updateSlide(firstSlideNode);
currentSlideNode = firstSlideNode;

} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
}
};
//

is there any solution to get rid of the flash and to preload the pix?


thanks a lot
best
florian

View Replies !    View Related
Flash XML Slideshow
I need a fully customizable flash xml slideshow, so that I can change fonts for the captions, put the captions over the pic, change everything I want and put captions, thumbnails in any part of the canvas, and even not show thumbnails if I want.

Any link to a site where I can purchase something like this? In the worst case maybe a tutorial? I'd rather learn to do it myself, but not now cause I'm in a hurry so I want to buy one...

View Replies !    View Related
Copyright Đ 2005-08 www.BigResource.com, All rights reserved