Hi I found this quite interesting do you mind to explain this in more detail. Actually I'm looking to create a pictures menu and viewer base on the xml file,
a loop to assign this
the xml.
<?xml version"1.0"?>

<pic> model1.jpg</pic>
<pic> model2.jpg</pic>
<pic> model3.jpg</pic>
<pic> model1.jpg</pic>


and in the as2, well I'm not sure about how to do it. but I'll need a loop to read each child in a mc and then add to them an onRelease behaviour in order to have them as buttons,
would you help me Seb?




Regards


Gustavo Duenas


On May 1, 2007, at 2:43 AM, sebastian wrote:

hi Michael,

quick reply here, but you may want to consider assigning the XML data to an Array instead of to variables. This way, you can call positions in the array easily.

So instead of:

bild = mein_xml.firstChild.childNodes[paktBild].attributes.pic;

you would have:

pictureArray = new array
for i loop with max = XML.children.length
pictureArray[i] = mein_xml.firstChild.childNodes[i].attributes.pic;
position = 0;//position tracker

next/previous just calls 'position' of 'pictureArray[i]' array and loads up. also saves reloading XML EVERY time you call an image [less load on server/flash]

cheers,

seb.

mastro wrote:
hello,
I'm looking for a solution witch can handle the following problem:
i need a mc witch will load several images and text dynamically from a folder into the flash-file. (the number of images change sometimes....) also 2 buttons should give the possibility to go from image 1 to image however and back...
my xml file looks like this:
<?xml version"1.0"?>
<Bilder>
<Bild name="Man on Mars - Lunatic Lander" pic="bilder/bild1.jpg"></ Bild>
<Bild name="Pluto City" pic="bilder/bild2.jpg">    </Bild>
<Bild name="Desert of Venus" pic="bilder/bild3.jpg">    </Bild>
<Bild name="Working Mines on Planet Mars" pic="bilder/bild4.jpg"></ Bild> <Bild name="Movement of the Terraformer" pic="bilder/bild5.jpg"></ Bild>
<Bild name="BOMAG"     pic="bilder/bild6.jpg"></Bild>
<Bild name="BOMAG Giant V2"     pic="bilder/bild7.jpg"></Bild>
</Bilder>
in flash on my mc the AS looks like:
--snip!
mein_xml = new XML();
mein_xml.ignoreWhite = true;
mein_xml.load("test.xml");
mein_xml.onLoad = function(status) {
if (status && this.loaded) {
anzahl = mein_xml.firstChild.childNodes.length;
geladen = true;
aktbild = 0;
ladeBild(aktBild);
}
};
function ladeBild(paktBild) {
status_mc._visible = 1;
bild = mein_xml.firstChild.childNodes[paktBild].attributes.pic;
bildname = mein_xml.firstChild.childNodes[paktBild].attributes.name;
loadMovie(bild, "bild_mc");
titel_txt.text = bildname;
}
weiter_btn.onRelease = function() {
if (geladen && aktbild<anzahl-1) {
aktbild++;
ladeBild(aktBild);
}
};
zuruck_btn.onRelease = function() {
if (geladen && aktbild>0) {
aktbild--;
ladeBild(aktBild);
}
};
---snip!
here is a link to a test file:
http://nano.machfeld.net/test/test.zip
someone an idea?
cheers,
michael
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Gustavo Duenas
Creative Director
LEFT AND RIGHT SOLUTIONS LLC
1225 W. Beaver St. Suite 119
Jacksonville, Fl.  32204
904 . 2650330
www.leftandrightsolutions.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to