I’m making a xml image gallery. And I need get the path from parent, and the image name from childnode.
But when I combine these two url in urlrequest, it doesn’t show the images and returns me “SecurityError: Error #2000: No active security context.” in the output.
Here is my xml code:
<gallery name="Poster" path="gallery/graphic_design/1/">
<image img="im1.jpg" thumb="thumb1.jpg"/>
<image img="im2.jpg" thumb="thumb2.jpg"/>
<image img="im3.jpg" thumb="thumb3.jpg"/>
</gallery>
Here is my as3 code
var main_path = gallery_xml.gallery.@path;
var thumb_url = main_path + images[i].@thumb;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
after I trace it. It shows all of the path from 5 galleries instead of the path from parent gallery.
gallery/graphic_design/1/gallery/graphic_design/2gallery/graphic_design/3gallery/graphic_design/3gallery/graphic_design/3gallery/graphic_design/3gallery/graphic_design/3thumb1.jpg
How should I make it only load path from parent?
Error #2000 is usually a file not found error. You can get more info from running an IOErrorEvent like so:
At hand, however, is the fact that the XML methods AS3 employs are looney (IMHO). As you can see, rather than pulling the one reference for path, it pulls all references for path followed by your specific reference for thumb.
Just from reading the output, it would seem your XML is much longer, containing 3 versions of the above code, each with an incremented graphic_design/#. If this is the case, you’re missing a reference in your dot.notation syntax to the specific version of @path you’re looking for.
In practice,
gallery_xml.gallery.@pathbecomesgallery_xml.gallery[0].@pathThis is because, when there are multiple entries of an element at a specific level in an XML structure, it’s basically an array of elements by that name.