Mastro --
One way to load a graphic file into a parent movie clip is to use a
MovieClipLoader to create a new movie clip with the graphic, nested in a
parent movie clip. Here is code where the selection is made with a ComboBox
that has graphic file pathways in its data parameter:
var listenerObject: Object = new Object(); //handles addEventListener() to
detect a change in the ComboBox
listenerObject.change = function (evt:Object):Void {
var imageLoader_ml: MovieClipLoader = new MovieClipLoader;
parent_mc.createEmptyMovieClip("child_mc",
parent_mc.getNextHighestDepth());
imageLoader_ml.loadClip(evt.target.selectedItem.data,
parent_mc.child_mc);
};
This might be useful for part of what you want to do.
-- Bob Hadsell
From: mastro <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: Flashcoders mailing list <[email protected]>
Subject: [Flashcoders] dynamic image loading in mc
Date: Tue, 1 May 2007 08:24:57 +0200
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
_______________________________________________
[email protected]
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
_________________________________________________________________
The average US Credit Score is 675. The cost to see yours: $0 by Experian.
http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE
_______________________________________________
[email protected]
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