Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

flash desgn layout question

Status
Not open for further replies.

none121

Technical User
Sep 6, 2007
3
CA
hello all.
I'm wondering if anyone can point me in the right direction.

The end result is a click through "how to" slide show.
Every "slide" will have an external movie loaded on the left and content from a text file on the right.

No problem so far. But now i'm finding that the number of "slides" will vary from 6 to 14 often.

i'm thinking.. can I store a value like MovieTotalNumber="9" in a text file and setup a flash movie to loop through loading every movie and text file up to number 9?

like
load 1.swf and 1.txt, then 2.swf and 2.txt, etc. etc.

Other people are creating the swf's and content so If i can automate the "total slides" value that would be sweet.

I'm thinking that if I make a nice looking page layout, i can adapt it to whatever number of "slides" they have.

any ideas on how an array like that might work in flash?
or links to some tutorials?

many thanks
none121
 
You can use this example as a starting point...

Of course the design would be your's, but the mechanics involved would be the same...

Loading .swfs instead of .jpgs, and replacing the captions by your texts

The number of "slides" is automatically calculated based upon the number of entries in the .xml file.



Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
wow. thanks SO much for that link.
that demo kicks ass.

one quick question... I'm unable to load swf's unless they have an image in them. loading just images works, loading images imbedded in swf's works, but an swf without any images fails to load.

Is it me? or the preloader trying to grab bytelength?
Thanks oldnewbie!
 
oops, the attached actionscript is below.

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
description = xmlNode.childNodes.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();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
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();
}
}
}
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();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top