i'm trying to figure out if it's a problem with scope, or if i'm overlooking
something else? this is a combination of moock's imageviewer walkthru from
his essential as book, but with xml functionality which i'm trying to
implement. i can't seem to keep the xml values in imageBank when i push()
them from _13 inside buildImageBank().
i can trace imageBank in loadImage() and get a type object but with no
children, yet i can trace the hell out of imageBank in buildImageBank() and
get all the attribute values. shed some light? here's the class, broken
down:
class ImageViewBare {
private var _12;
private static var _11 = 0;
private static var _13;
private var imagePos = 0;
private var container;
private static var images;
private static var imageBank = [];
public function ImageViewBare (target, depth, xmlfile) {
container = target.createEmptyMovieClip("container" + depth, depth);
images = new XML();
images.ignoreWhite = true;
images.onLoad = buildImageBank;
images.load(xmlfile);
}
private function buildImageBank() {
_12 = images.firstChild.childNodes;
while (_11 < _12.length) {
_13 = {
name: _12[_11].attributes.name,
notes: _12[_11].attributes.notes,
file: _12[_11].attributes.file,
width: _12[_11].attributes.width,
height: _12[_11].attributes.height
}
// this gets lost outside buildImageBank()
// how to make my push()'s to imageBank var permanent?
imageBank.push (_13);
_11++;
}
}
public function loadImage(posInc) {
container.loadMovie(imageBank[index].file);
}
}
on the fla that works this class, i have this:
var viewer = new ImageViewerBare(this, 1, "images.xml");
viewer.loadImage(1); // comes back undefined
thanks,
M.
_______________________________________________
[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