Load xml image to button - help

im bulding a photographer web site.
and for each picture i want to have its thumbnail as a
button.
but i want the image of the thumbnail button to be loaded by
an xml file.
can any one help ? or send me a file ?
thanksss

The bug you are referencing occurs when an Enumerated Value also has min and max lengths specified..
Eg something like
<xsd:simpleType name="EnumType">
     <xsd:annotation>
         <xsd:documentation>ENUM_TYPE</xsd:documentation>
     </xsd:annotation>
     <xsd:restriction base="xsd:string">
         <xsd:enumeration value="AA"/>
         <xsd:enumeration value="AB"/>
         <xsd:enumeration value="AE"/>
         <xsd:enumeration value="AK"/>
         <xsd:enumeration value="AL"/>
     </xsd:restriction>
   </xsd:simpleType>
   <xsd:complexType name="TYPE1">
     <xsd:sequence>
         <xsd:element name="TYPE11">
           <xsd:simpleType>
               <xsd:restriction base="EnumType">
                 <xsd:minLength value="1"/>
                 <xsd:maxLength value="10"/>
               </xsd:restriction>
           </xsd:simpleType>
         </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
</xsd:schema> Do you have something like this in your XML Schema. If this is the case try removing the minLength, maxLength as they are redundant, which is probably why we didn't catch this one in internal testing, it sort of falls into the "if it hurts please don't do it" category :). Also the fix for this bug appears to have been backported on top of 9.2.0.6.0 so upgrading to 9.2.0.7.0 or 9.2.0.8.0 or the later releases of 10.1 or 10.2 should fix the problem.

Similar Messages

  • Making a loaded external image into a button in Actionscript

    My name is Steve Oatman I am a student at
    AIO for a Web Design Diploma
    class: Interactive Telecommunications IMD412 XA
    Professors to bussy!
    I have a flash web site that I am putting together. I am using AS to load some images from an external source. These images are being loaded into a movieclip. These images need to become buttons once they are loaded. The images will link to the particular menu category pages beef, chicken, etc.
    The images are loading fine they just are not responding like a button or link.
    I am getting two error referencing the buttonMode and usehandCursor. Below is just one image that I am working on till I get it to work.
    I am getting these two Compiler error code:
    1119: Access of possibly undefined property buttonMode through a reference with static type flash.display:Loader.
    1119: Access of possibly undefined property useHandCursor through a reference with static type flash.display:Loader.
    This is what I have.
    var myLoader01:Loader = new Loader();
    myLoader01.load(new URLRequest("entrees_images/beef/beef01.gif"));
    addChild(myLoader01);
    myLoader01.x = -269;
    myLoader01.y = -164;
    myLoader01.buttonMode = true;
    myLoader01.useHandCursor = true;
    myLoader01.addEventListener(MouseEvent.CLICK, beefClick);
    function beefClick(event:MouseEvent):void{
    gotoAndStop("beef");
    From me searching online I thought the
    name.buttonMode = true;
    turned the element into a button!
    I have included the fla file. This is in the menuItems_mc which is located in the pageContent_mc frame 40 layer page Image or of course the library.
    I know this is a little in depth sorry and any help would be greatly appreciated.
    Steve
    713/742-3325

    Try something along the following lines:
    var myLoader01:Loader = new Loader();
    function addIt(evt:Event):void{
       var aBtn:MovieClip = new MovieClip();
       aBtn.x = -269;
       aBtn.y = -164;
       aBtn.buttonMode = true;
       addChild(aBtn);
       aBtn.addChild(myLoader01);
       aBtn.addEventListener(MouseEvent.CLICK, beefClick);
    myLoader01.contentLoaderInfo.addEventListener(Event.COMPLETE, addIt);
    myLoader01.load(new URLRequest("entrees_images/beef/beef01.gif"));
    function beefClick(event:MouseEvent):void{
       gotoAndStop("beef");

  • Desperately seeking help for displaying image on button

    i wrote the following method to create and display a button with an icon, doesn't work and i cannot figure out what the problem might be and how to fix it, please help me...
    clo :))
    public static void addButton(Container c, String title,
    ActionListener listener)
    JButton button = new JButton(title);
    button.setBorder(null);
    button.setFocusPainted(false);
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
    ImageIcon icon = new ImageIcon("anImage.jpg");
    button.setIcon(icon);
    c.add(button);
    button.addActionListener(listener);
    the parameter c is of JPanel type and gets added to a JFrame object,
    the source compiles and runs but i see no image on my button, sigh :((!
    PS(the image file is placed in the same dir as the source file).

    Why buttons and labels might not show up the icon?
    Either your image is not in the classpath and you are trying to load it as a resource: see
    http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html
    or you are running the java machine from a different directory that you expect it does.
    or the file doesn't exist.
    To prove that the system cannot load the image use the example in the above link and the url will be null.
    URL iconURL = ClassLoader.getSystemResource("anImage.jpg");

  • Help with load xml driven swf in another swf

    Hello people ... (sorry for my Google transalte English)
    ... I am desperate, tapping in place last week.
    In fact, i make flash CD presentation in Adobe Flash CS5 AS2 (with minimal use of ActionScript). It  occurs to me the next problem ... need to load flash image gallery that i already have created, in new presentation file. Gallery  was created in Flash Slideshow maker and as products I have. Swf,. Xml  and folders with thumbnails and picture (no. Fla file).
    The concept of the presentation (as root is concerned) should look like in uploaded picture "izgled otvorenog cd-a". In each of the folder on cd presentation (as on picture) is a Flash presentation controlled by their xml file whose name I must not change. Exe file "Prezentacija 2011" is a presentation (Flash Projector) that i try to make. In the same presentation i create frames and for each of the frames added action:
    loadMovie ("02_Kapije/kapije.swf", "kapije_ucitavanje");
    kapije_ucitavanje._x = 23;
    kapije_ucitavanje._y = 167;
    stop ();
    (Of course, for each item varies loadMovie root and instance name).
    The problem is that presentations can't find xml file, apparently because they do not have the appropriate root. When  all the files of the one gallery set in the same folder with  the "Presentation 2011.exe" file, everything works normally (  however, as i said, i cannot change the name of Xml file and that disturb the concept of my CD presentation).
    How can I drive loaded swf file from the above script to use Xml file in its folder?
    HELP PLEASE!!!
    P.S. ...and it looks so easy

    you're welcome.
    p.s.  please mark helpful/correct responses.

  • XML grid gallery not loading full images(except for one)

    hi,
    I just created my first flash website, but one of my XML image galleries is not working properly. I am using the same (code, layout, just different pics and xml files) gallery on 4 of my pages, however, one("products")  of the 4 will not load the "full" images. The thumbnails load, they decrease opacity when moused over, but once you click on one, the progress bar loads till complete and just stops. You can see the problem in action atwww.erikhigbee.com on the "Products" page. This problem, however, only occurred after I hosted it on iPage.com. When I test it (Ctrl+Enter) in Flash, test it in Dreamweaver or open the .html of it from my computer, everything works perfectly. It is only after I FTP upload all the files to iPage's server that this problem occurs. I made sure to keep the filetree the same and everything. Is it a problem with Ipage? Are too many images trying to load??
    Furthermore, for some odd reason the 1st image(left), 4th row down on the s"Products" page DOES load the full image but the others still dont and I can't for the life of me figure out why. All the code is exactly the same as on the other pages.
    Thanks for any and all help/advice you can give me!
    one thought(from posts on other forums) could be inefficient code.  Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed. pops up whenever the thumbs are clicked.  idk if that helps.
    below is the code i used for the gallery. Could anyone take a quick look over it and see if any problems/inefficiencies jump out at ya??
    [CODE]import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.MouseEvent;
    import fl.controls.ProgressBar;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    var columns:Number;
    var my_x:Number;
    var my_y:Number;
    var my_thumb_width:Number;
    var my_thumb_height:Number;
    var my_images:XMLList;
    var my_total:Number;
    var container_mc:MovieClip;
    var preloaders_mc:MovieClip;
    var full_mc:MovieClip;
    var x_counter:Number = 0;
    var y_counter:Number = 0;
    var my_tweens:Array = [];
    var container_mc_tween:Tween;
    var full_tween:Tween;
    var myXMLLoader:URLLoader = new URLLoader();
    myXMLLoader.load(new URLRequest("gallery_hats.xml"));
    myXMLLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void{
    var myXML:XML = new XML(e.target.data);
    columns = myXML.@COLUMNS;
    my_x = myXML.@XPOSITION;
    my_y = myXML.@YPOSITION;
    my_thumb_width = myXML.@WIDTH;
    my_thumb_height = myXML.@HEIGHT;
    my_images = myXML.IMAGE;
    my_total = my_images.length();
    createContainer();
    callThumbs();
    myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
    myXMLLoader = null;
    function createContainer():void{
    container_mc = new MovieClip();
    container_mc.x = my_x;
    container_mc.y = my_y;
    addChild(container_mc);
    container_mc.addEventListener(MouseEvent.CLICK, callFull);
    container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
    container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
    container_mc.buttonMode = true;
    preloaders_mc = new MovieClip();
    preloaders_mc.x = container_mc.x;
    preloaders_mc.y = container_mc.y;
    addChild(preloaders_mc);
    function callThumbs():void{
    for (var i:Number = 0; i < my_total; i++){
    var thumb_url = my_images[i].@THUMB;;
    var thumb_loader = new Loader();
    thumb_loader.load(new URLRequest(thumb_url));
    thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
    thumb_loader.name = i;
    thumb_loader.x = (my_thumb_width+10)*x_counter;
    thumb_loader.y = (my_thumb_height+10)*y_counter;
    if (x_counter+1 < columns){
    x_counter++;
    } else {
    x_counter = 0;
    y_counter++;
    var preloader_pb:ProgressBar = new ProgressBar();
    preloader_pb.source = thumb_loader.contentLoaderInfo;
    preloader_pb.x = thumb_loader.x;
    preloader_pb.y = thumb_loader.y;
    preloader_pb.width = my_thumb_width;
    preloader_pb.height = my_thumb_height/10;
    preloaders_mc.addChild(preloader_pb);
    preloader_pb.addEventListener(Event.COMPLETE, donePb);
    function thumbLoaded(e:Event):void{
    var my_thumb:Loader = Loader(e.target.loader);
    container_mc.addChild(my_thumb);
    my_tweens[Number(my_thumb.name)]=new Tween(my_thumb, "alpha", Strong.easeIn, 0,1,0.5, true);
    my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
    function callFull(e:MouseEvent):void{
    var full_loader = new Loader();
    var full_url = my_images[e.target.name].@FULL;
    full_loader.load(new URLRequest(full_url));
    full_loader.contentLoaderInfo.addEventListener(Event.INIT, fullLoaded);
    var full_pb:ProgressBar = new ProgressBar();
    full_pb.source = full_loader.contentLoaderInfo;
    full_pb.x = (stage.stageWidth - full_pb.width)/2;
    full_pb.y = (stage.stageHeight - full_pb.height)/2;
    preloaders_mc.addChild(full_pb);
    full_pb.addEventListener(Event.COMPLETE, donePb);
    container_mc.removeEventListener(MouseEvent.CLICK, callFull);
    container_mc.buttonMode = false;
    container_mc.removeEventListener(MouseEvent.MOUSE_OVER, onOver);
    container_mc.removeEventListener(MouseEvent.MOUSE_OUT, onOut);
    container_mc_tween = new Tween(container_mc, "alpha", Strong.easeIn, 1,0.5,0.5, true);
    function fullLoaded(e:Event):void{
    full_mc = new MovieClip();
    full_mc.buttonMode = true;
    addChild(full_mc);
    var my_loader:Loader = Loader(e.target.loader);
    full_mc.addChild(my_loader);
    full_tween = new Tween(my_loader, "alpha", Strong.easeIn, 0,1,0.5, true);
    my_loader.x = (stage.stageWidth - my_loader.width)/2;
    my_loader.y = (stage.stageHeight - my_loader.height)/2;
    my_loader.addEventListener(MouseEvent.CLICK, removeFull);
    my_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, fullLoaded);
    function removeFull(e:MouseEvent):void{
    var my_loader:Loader = Loader (e.currentTarget);
    full_tween = new Tween(my_loader, "alpha", Strong.easeOut, 1,0,0.5, true);
    full_tween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
    container_mc_tween = new Tween(container_mc, "alpha", Strong.easeOut, 0.5,1,0.5, true);
    function donePb(e:Event):void{
    var my_pb:ProgressBar = ProgressBar(e.target);
    preloaders_mc.removeChild(my_pb);
    my_pb.removeEventListener(Event.COMPLETE, donePb);
    function tweenFinished(e:TweenEvent):void{
    var my_loader:Loader = Loader (e.target.obj);
    my_loader.unload();
    full_mc.removeChild(my_loader);
    removeChild(full_mc);
    full_mc = null;
    container_mc.addEventListener(MouseEvent.CLICK, callFull);
    container_mc.buttonMode = true;
    container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
    container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
    var my_tween:Tween = Tween(e.target);
    my_tween.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
    function onOver(e:MouseEvent):void{
    var my_thumb:Loader = Loader(e.target);
    my_thumb.alpha = 0.5;
    function onOut(e:MouseEvent):void{
    var my_thumb:Loader = Loader(e.target);
    my_thumb.alpha = 1;
    [/CODE]

    Hi,
    at www.lynda.com there is a great video tutorial.
    Search for Create and Embed a Photo Gallery in a PDF

  • Flash XML Slideshow - Load next image after set amount of time

    I'm creating flash xml slideshow and have managed to get the
    images to load from the XML file. What I want to do now is have a
    timer that loads the next image after x amount of seconds. Any help
    would be great.
    Code sample
    stop();
    // Create XML Object
    slideshow_xml = new XML();
    // Start slideshow once XML file is loaded
    slideshow_xml.onLoad = startSlideShow;
    //Load XML file
    slideshow_xml.load("slideshow.xml");
    //Ignore Whitespace in XML Document
    slideshow_xml.ignoreWhite = true;
    //Create Function for Slideshow - Shows first slide and
    initalises variables
    function startSlideShow(success) {
    if (success == true) {
    rootNode = slideshow_xml.firstChild;
    totalSlides = rootNode.childNodes.length;
    firstSlideNode = rootNode.firstChild;
    currentSlideNode = firstSlideNode;
    currentIndex = 1;
    updateSlide(firstSlideNode);
    function updateSlide(newSlideNode) {
    imagePath = newSlideNode.attributes.jpgURL;
    slideText = newSlideNode.firstChild.nodeValue;
    loadMovie(imagePath, loadTarget);
    }

    Ok I've managed to get most of this working including the
    alpha fade in. I haven't been able to get the images to fade out
    (fadeImageOut function) so if someone can tell me what I'm doing
    wrong. Also should I have some sort of preloader function for when
    each image loads? and if so any pointers, then it should be done
    except that I might need to add some text for each image in the XML
    file.
    stop();
    var container:MovieClip =
    this.createEmptyMovieClip("container", this.getNextHighestDepth());
    var loader1:MovieClip = this.createEmptyMovieClip("loader1",
    this.getNextHighestDepth());
    var loader2:MovieClip = this.createEmptyMovieClip("loader2",
    this.getNextHighestDepth());
    container._x = 0;
    container._y = 0;
    function fadeImageIn() {
    var fadeTween = new mx.transitions.Tween(loader1, "_alpha",
    mx.transitions.easing.Regular.easeIn, 0, 100, 1.5, true);
    loadmovie(imagePath, loader1);
    function fadeImageOut(loader1) {
    var fadeTween = new mx.transitions.Tween(loader1, "_alpha",
    mx.transitions.easing.Regular.easeOut, 100, 0, 1.5, true);
    unloadMovie(loader1);
    // Create XML Object
    slideshow_xml = new XML();
    // Find out what this does
    slideshow_xml.onLoad = startSlideShow;
    //Load XML file
    slideshow_xml.load("slideshow.xml");
    //Ignore Whitespace in XML Document
    slideshow_xml.ignoreWhite = true;
    //Create Function for Slideshow - Shows first slide and
    initalises variables
    function startSlideShow(success) {
    if (success == true) {
    rootNode = slideshow_xml.firstChild;
    totalSlides = rootNode.childNodes.length;
    firstSlideNode = rootNode.firstChild;
    currentSlideNode = firstSlideNode;
    currentIndex = 1;
    updateSlide(firstSlideNode);
    function updateSlide(newSlideNode) {
    imagePath = newSlideNode.attributes.jpgURL;
    slideText = newSlideNode.firstChild.nodeValue;
    //loadMovie(imagePath, loader1);
    fadeImageIn();
    function nextSlideImage() {
    nextSlideNode = currentSlideNode.nextSibling;
    if (nextSlideNode == null) {
    rootNode = slideshow_xml.firstChild;
    totalSlides = rootNode.childNodes.length;
    firstSlideNode = rootNode.firstChild;
    currentSlideNode = firstSlideNode;
    currentIndex = 1;
    updateSlide(firstSlideNode);
    } else {
    currentIndex++;
    updateSlide(nextSlideNode);
    currentSlideNode = nextSlideNode;
    slideTimer = setInterval(nextSlideImage, 5000);

  • How to load XML files ? HELP!

    Hi folks.
    We have an old Oracle database 7.3..
    So we need to load XML files into its tables.
    As we understand Oracle Loader doesn't help us.
    Is the way to load that files?
    Thanks in advance
    Alex

    I know you realize 7.3 is old but this is sort of like trying trying to view a DVD when you only have a VCR. Simple answer would be buy a DVD player, i.e. upgrade to a more recent version of Oracle where you will get many features to handle XML.
    How do you want the XML loaded, all as a single object? That could be a CLOB column if 7.3 had them, I am not sure. You would probably have to write PL/SQL and something with UTL_FILE (if 7.3 had that) to load it.
    If you want to put it multiple columns based on its tags, you would be better off parsing it using PERL (or something) into a CSV and loading that in SQL*Loader.
    I assume as this is using XML it is a reasonably recent design, combining that with an ancient version of the database is just going to lead to endless headaches.

  • Pre-loading external images for XML-based gallery

    I'm working-on an XML-based photo gallery here:
    http://www.unionandparkwood.com/demo/flash_gallery/
    It works how I want it, except that the first time a
    thumbnail is clicked for an image, it pauses long enough to skip
    the fade. If you click-through the images a second time, you'll see
    that it works smoothly. My guess is that the first time the
    thumbnail is clicked, the image isn't cached, yet.
    I tried to fix this by creating a JavaScript file for the
    page to pre-load each image and thumbnail:
    0003a = new Image;
    0003a.src = "images/Down-Range.jpg";
    0003b = new Image;
    0003b.src = "thumbnails/Down-Range.jpg";
    But that didn't work. What would be the best way to do this?
    I included a link to "Download ZIP" of the FLA project on
    this page, too, because it wouldn't be easy for me to describe
    what's happening. In a nutshell, a thumbnail click launches a
    function that loads the appropriate image into the main image
    holder. What seems to be happening the first time is the image
    isn't loaded before the fade is finished, so the image just appears
    after a short pause the first time.

    >>What seems to be happening the first time is the
    image isn't loaded before
    >>the fade is finished, so the image just appears after
    a short pause the
    >>first time.
    As has been said many times in thos forum - use the
    MovieClipLoader class to
    load images, and then use that class' onLoadInit method to do
    things with
    the loaded image. Loading is asynchronous - you _have_ to
    wait until the
    image is done loading before doing a fade.
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Button to load dynamic image in interactive form webdynpro for java

    Hi all
    i tried to use image field to load dynamic image as shown in the online interactive form tutorial
    and it worked for test but when try it with view appears inside viewset it doesnt....
    so i think if we could call the image after render by pressing a button inside the form it may work
    but the problem is i have no idea about how to implement such solution ,so if any one has any idea about how to implement such solution i will be thankful if he can share me the solution.
    thanks.....
    Naguib..

    use the following tutorial. it is very easy to follow and it works fine, i have tried that.
    http://www.docstoc.com/docs/2540673/How-To-Integrate-ADOBE-form-on-WebdynPro-for-ABAP-and-Deploy-it-
    in case of some more problems, ask again and point out the part of tutorial where there is a problem.

  • Help With Loading an Image In AIR

    I need to load an image (GIF) with AIR using File and FileStream, but can't figure out how to do it. I need to load the image into a Bitmap or BitmapData object, so I can't use the loader class. Here's what I have so far:
    import flash.display.*;
    import flash.events.*;
    import flash.filesytem.*;
    import flash.net.FileFilter;
    import flash.utils.ByteArray;
    import flash.geom.Rectangle;
    var file:File = File.documentsDirectory;
    var myImage:BitmapData;
    var myFilter:FileFilter = new FileFilter("GIF Image","*.gif");
    file.addEventListener(Event.SELECT,loadImage);
    file.browseForOpen("Open",[myFilter]);
    function loadImage(e:Event):void{
    var stream:FileStream = new FileStream();
    stream.open(file,FileMode.READ);
    var bytes:ByteArray = new ByteArray();
    stream.readBytes(bytes);
    stream.close();
    //By the way, this image is a special format and will always be 160 by 160 pixels.
    myImage = new BitmapData(160,160);
    bytes.position = 0;
    myImage.setPixels(new Rectangle(0,0,160,160),bytes);
    addChild(new Bitmap(myImage));
    However, this never works. I always get this error:
    Error #2030: End of file was encountered.
    I don't quite understand why. Help would be much appreciated.

    I already know how to do that, but I specifically stated in my post that I can't use the Loader class. The reason for that is that my program is an image manipulation program, and I need to load the data into a BitmapData object. However, since I originally made my post, I have found some more information. I used trace() to find out the length of the ByteArray I was loading the data into, and then the position after trying to create the BitmapData object, like so:
    import flash.display.*;
    import flash.events.*;
    import flash.filesytem.*;
    import flash.net.FileFilter;
    import flash.utils.ByteArray;
    import flash.geom.Rectangle;
    import flash.errors.EOFError;
    var file:File = File.documentsDirectory;
    var myImage:BitmapData;
    var myFilter:FileFilter = new FileFilter("GIF Image","*.gif");
    file.addEventListener(Event.SELECT,loadImage);
    file.browseForOpen("Open",[myFilter]);
    function loadImage(e:Event):void{
         var stream:FileStream = new FileStream();
         stream.open(file,FileMode.READ);
         var bytes:ByteArray = new ByteArray();
         stream.readBytes(bytes);
         stream.close();
         trace(bytes.length); //Outputs: 4631
         //By the way, this image is a special format and will always be 160 by 160 pixels.
         myImage = new BitmapData(160,160);
         bytes.position = 0;
         try{
              myImage.setPixels(new Rectangle(0,0,160,160),bytes);
         } catch(e:EOFError){
              trace(bytes.position); //Outputs: 4628
         addChild(new Bitmap(myImage));
    As the comments show, though the ByteArray is 4631 bytes, it is only read up until byte number 4628. Then it throws an error. Any idea what's going on?

  • How do i load an image through XML?

    Hi.
    My code is below. What I am trying is to dinamically load images from xml. I attach the holder from the library, and when i try to target it and addChild to him i get an error:
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("links.xml"));
    var xmlLength:int;
    var iconPos:Number = 0;
    function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    var xmlLength = xmlData.link.length();
    for (var i=0; i<xmlLength; i++) {
    var d:MovieClip = new icon();
    content_mc.addChild(d);
    d.name = "d"+i;
    var target:DisplayObject = content_mc.getChildByName("d"+i);
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest(xmlData.link[i].icon));
    target.addChild(ldr);
    How can i make this happen and load the image into it's holder?
    Thank you.

    Code from adobe's sample packages cut&&paste&&edit:
    AS4 code:
    import flash.events.IOErrorEvent;
    var fotoElenco:Array;
    var fotoXML:XML;
    var fotoURLRequest:URLRequest=new URLRequest();
    var fotoURLLoader:URLLoader=new URLLoader();
    var fotoLoader:Loader=new Loader();
    var fotoPosition:Number=0;
    var errorMessage:TextField=new TextField();
    caricaFoto();
    function caricaFoto():void
        addChild(errorMessage);
        fotoURLRequest.url="gallery.xml";
        fotoURLLoader.load(fotoURLRequest);
        fotoURLLoader.addEventListener(Event.COMPLETE, showFoto);
        fotoURLLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorEventXML);
    function ioErrorEventXML(event:IOErrorEvent):void
        manageErrorMessage(true, 0);
    function manageErrorMessage(val:Boolean, num:Number):void
        if(val && num==0){
            errorMessage.x=stage.stageWidth/2;
            errorMessage.y=stage.stageHeight/2;
            errorMessage.text="Errore caricamento file XML";
        if(val && num==1){
            errorMessage.x=stage.stageWidth/2;
            errorMessage.y=stage.stageHeight/2;
            errorMessage.text="Errore caricamento file IMMAGINE";
    function showFoto(event:Event):void
        fwd_mc.buttonMode=true;
        back_mc.buttonMode=true;
        back_mc.addEventListener(MouseEvent.CLICK, manageFoto);
        fwd_mc.addEventListener(MouseEvent.CLICK, manageFoto);
        fotoElenco=new Array();
        fotoXML=XML(fotoURLLoader.data);
        for each(var prop:XML in fotoXML.foto)
            fotoElenco.push({url:prop.@url, didascalia:prop.@didascalia});
        viewFoto(fotoPosition);
        gallery_mc.addChild(fotoLoader);
        manageButton();
    function manageButton():void
        if(fotoPosition<1){
            back_mc.visible=false;
        }else{
            back_mc.visible=true;
        if(fotoPosition>=fotoElenco.length-1){
            fwd_mc.visible=false;
        }else{
            fwd_mc.visible=true;
    function manageFoto(event:MouseEvent):void
        switch(event.currentTarget)
            case fwd_mc:
                if(fotoPosition<fotoElenco.length-1)
                    fotoPosition++;
            break;
            case back_mc:
                if(fotoPosition>0)
                    fotoPosition--;
            break;
        viewFoto(fotoPosition);
    function viewFoto(num:Number):void
        fotoLoader.load(new URLRequest(fotoElenco[num].url));
        fotoLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorEventIMG);
        didascalia_txt.text=fotoElenco[num].didascalia;
        manageButton();
    function ioErrorEventIMG(event:IOErrorEvent):void
        manageErrorMessage(true, 1);
    XML code:
    <?xml version="1.0" encoding="UTF-8"?>
    <gallery>
        <foto url="img/immagine1.jpg" didascalia="Didascalia 1 foto"/>
        <foto url="img/immagine2.jpg" didascalia="Didascalia 2 foto"/>
        <foto url="img/immagine1.jpg" didascalia="Didascalia 1 foto"/>
        <foto url="img/immagine2.jpg" didascalia="Didascalia 2 foto"/>
    </gallery>

  • Loading Single Image Via XML

    Hey guys, I am trying to load a single image on to the stage via an xml file.
    Here is my xml file
    <?xml version="1.0" encoding="utf-8"?>
        <pictures>
            <pic>image1.jpg</pic>
        </pictures>
    I'm trying to figure out the actionscript 3 code but I don't know how to code it.
    If someone can please point me to the code or tutorial, it would be much appreciated.

    You would load the xml by doing this:
    var req:URLRequest = new URLRequest("xmlfilename.xml");
    var ldr:URLLoader = new URLLoader();
    ldr.addEventListener(Event.COMPLETE,xmlLoaded);
    ldr.load(req);
    function xmlLoaded(e:Event){
      var xml:XML = XML(e.target.data);
    //see * below..
    * then the code to load the image could go in the xmlLoaded function (in place of that //see below line), and would look like this:
    var imgreq:URLRequest = new URLRequest(xml.pictures.pic[0]);
    var imgldr:Loader = new Loader();
    imgldr.load(imgreq);
    addChild(imgldr);
    Normally you might add a listener to the Loader's contentLoaderInfo, so that you could then size or position the image before adding it to the stage. But hopefully the above code would get you as far as having the image in the top left of the stage.
    Read up more on Loader, URLRequest, URLLoader, and XML, to get a sense of the various parts of the whole process.

  • Help with loading multiple images via LoadVars

    Hello everybody.
    I need a hand loading multiple images using the LoadVars
    method with a text file. I can get it to load 1 image but not
    anymore than that. I am aware of other methods like using
    components but I am looking for a method where I can access and
    change all data from 1 text file (there will be text variable text
    within the file aswell to, but I am more concerned with the images
    at the moment).
    Anyway on to the issue. I have created a much simple .fla
    file that outlines my problem.
    The movie contains 3 layers:
    - top layer contains AS
    - middle layer contains an empty movie clip with the
    instance name of mcImage1
    - bottom layer contains an empy movie clip with the instance
    name of mcImage2
    The AS layer contains the following code:
    imagedata = new LoadVars()
    imagedata.load("data.txt")
    imagedata.onLoad = function(ok){
    if(ok){
    mcImage1.loadMovie(this.Image1)
    mcImage2.loadMovie(this.Image2)
    } else trace("Problem Loading")
    In the same folder of my .swf file I have a text file called
    data.txt which contains the following
    &Image1=image1.gif
    &Image2=image2.gif
    Also in the same folder of my .swf file I have two images
    image1.gif and image2.gif.
    When I run the flash the image2.gif is imported correctly.
    image1.gif does not appear.
    You can download my source files and all images here
    http://www.myrealpage.com/projects/var_test/var_test.zip
    Any help that can be shed on this problem is much
    appreciated.
    Thanks
    Matt

    Glad to help. It is just that I see so many folks who have
    two different parts of a problem smushed together – each
    problem isn't so hard on its own, but together they are difficult
    to wrap your head around. Always try and break down each step of
    the problem and it will help you in the end.
    That being said, I'm not quite so sure on this next problem.
    I don't do so much timeline stuff along with the Actionscript. I
    can get tricky. So this I don't quite have as much of clear mental
    picture of what you are describing. But here are some questions
    that I would ask – either of myself if I was doing it or of
    you.
    Is there a stop() on frame one to wait for the
    LoadVars.onLoad? Does the onLoad then say to play?
    If not, what happens if we get to Frame 10 before the
    LoadVars has even finished? That could be a problem.
    Remember that the LoadVars object is an actual object that
    will exist until it is deleted or removed in various ways. You can
    access it at any time after it is loaded. The onLoad event handler
    is just that thing you want to happen immediately after it is
    loaded.
    So my design would probably be.
    LoadVars on Frame 1.
    Where I am stopped.
    In the onLoad handler load the first image and tell the
    timeline to play
    On frame 10, the LoadVars object will still exist (unless
    you've deleted it)
    Get the variable out of the LoadVars and load the image.
    If you want to check this. Put a stop() in frame 10 and run
    it in the testing environment. When it gets to that frame, go to
    the debug menu and List Variables. You should see that your
    LoadVars object is still there.
    Does that answer your question or am I totally missing the
    point?

  • Need help with loading XML file

    Hello,
    I have been browsing the web/forums for an example on how to do this for a few days now.  I managed to get this working in Flash Pro quite easily but I think I am missing something when I want to do the same thing in Flex.
    Basically I want to load an XML file and then set the text values of 5 labels equal to the data in the XML file.
    So I a button created in MXML and have set the click event as follows:
         click="dsSetup(event)"
    I have also declared the following:
         public var myRequest:URLRequest = new URLRequest("assets/myFile.xml");   //folder located under src in project
         public var myLoader:URLLoader = new URLLoader();
         public var myXML:XML;
    My function that loads is as follows:
    public function dsSetup(event:MouseEvent):void
         trace ("dsSetup");
         myXML = new XML (myLoader.data);
         h3.text = myXML.source.itemA;
         h4.text = myXML.source.itemB;
         h5.text = myXML.source.itemC;
         h7.text = myXML.source.itemD;
         h8.text = myXML.source.itemE;
         currentState = 'MainMenu';
    myLoader.addEventListener(Event.COMPLETE, dsSetup);   // I think this line is now redundant as I have set it in the MXML
    myLoader.load(myRequest);
    This is the way I did it in Flash and it worked ok but I must be missing something in when it comes to Flex.
    Can someone explain or point me to a good tutorial that shows how to load XML in Flex? 
    The ones I found seem to have about 50 lines of code just to load a file and add in way to much complexity for a beginner.
    Many Thanks

    I would suggest to save the loaded data in a Bindable variable and then to bind the text-properties to that:
    [Bindable]
    var myXML:XML;
    public function dsSetup(event:MouseEvent):void
         myXML = new XML (myLoader.data);
         currentState = 'MainMenu';
    <s:Label text="{myXML.source.itemA}"/>

  • Unable to load any XML from JAR - Please help!!

    Hi All,
    I am a student in the final days of my degree. I have been working on my final project for some time now, an applet which converts input text to a signal plot for line encoding schemes - AMI, NRZ etc. It is pretty much finished, but one small bug threatens to scuttle the entire project! I have been searching the web all day long for answers with little success, and as the castor forum still appears to be down I am posting here. Any suggestions or advice would be greatly appreciated.
    The applet uses the castor databinding framework to load various XML data. I am using Eclipse 3.01 for development - when the program is run locally as an applet, everything works fine. When the program is bundled into a JAR file and nested into a clean folder with a html page and the jar file, when the command to read in XML is given, a NullPointerException occurs, indicating that castor was unable to access the XML files.
    Below is one of the methods used to make castor load XML data:
         public CodeSet loadCodeXML(String _codesetFilename)
              String _mappingURI = "schema/codes/codesets-mapping.xml";
              String _codesetURI = "schema/codes/" + _codesetFilename;
                    // Create a new Castor mapping object
              Mapping mapping = new Mapping();                         
            try                                                                 // Attempt to load in the selected XML character set
                 mapping.loadMapping(_mappingURI);                    // Initialize 'mapping' with the map file
                Unmarshaller unmar = new Unmarshaller(mapping); // Create a new XML Unmarshaller that uses 'mapping'
                // The line below creates a new CharSet object called _codeset and populates it with the XML data
                CodeSet _codeset = (CodeSet)unmar.unmarshal(new InputSource(new FileReader(_codesetURI)));
                // The character set was successfully loaded, so pass new CharSet object back to caller and end
                return _codeset;
            } catch (Exception e) {
                 // If an error occurs while extracting the XML data, this block will execute:
                JOptionPane.showMessageDialog(null, e);               // Display a message dialog containing the exception error
                return null;                                             // Do not return a CharSet object to caller
         }It would seem to me the problem lies within
              String _mappingURI = "schema/codes/codesets-mapping.xml";
              String _codesetURI = "schema/codes/" + _codesetFilename;I have read that files inside a JAR can be accessed in this way ( http://archive.codehaus.org/castor/user/msg00025.html ) but it won't appear to work.
    If these are set to a full system path (outside any JAR) i.e. "/home/me/proj/schema/codes/codesets-mapping.xml", the application operates fine. Clearly this is no good however, as the XML data must reside within the JAR package. I have tried many permutations such as "jar://schema/..." , "/schema/..", "schema/..", with no success. I have read of using InputStream and getResource methods to access files within the jar but have had no success. I have checked the schema dir is being put into the JAR archive.
    Could anyone suggest an appropriate way of loading XML files from within a JAR file in this context?
    Thanks in advance for any replies.

    Hi, me again..
    Re: mr_doghead - the filename of the file is passed from the calling function
    public CodeSet loadCodeXML(String _codesetFilename)eg loadCodeXML(ami.xml) will return a CodeSet object containing the ami xml data
    Anyway, I've manged to fix it up. The problem actually lies within castor, not my code at all. This is a known bug in castor that the dev's deemed 'not important' to fix, but I have to say the work around is EXTREMLY poorly documented online. Hence, this post is just to say how to fix it up if ne1 else is having trouble...
    To load mappings, use:
    mapping.loadMapping(getClass().getResource(_mappingURI).toString());where _mappingURI is a string such as "/xml/mapfile.xml"
    However, the unmarshalling method takes in a file object, so getResourceAsStream must be used:
    CharSet _charset = (CharSet)unmar.unmarshal(new InputSource(getClass().getResourceAsStream(_charsetURI)));Where CharSet is your custom object you are marshalling into, and _charsetURI is a relative path to your xml file.
    Ugly as hell? Very.
    Does it work? Perfectly.
    take it ez guys, time for me to go hand this sht in! ;D

Maybe you are looking for

  • Download Issue / Error - Acrobat XI from Creative Cloud

    Hi I'm getting the following error (failed to load) message at 89% of the download from Creative Cloud... Exit Code: 7 Please see specific errors below for troubleshooting. For example,  ERROR: DW006 ...  -------------------------------------- Summar

  • How can I change the name in Bluetooth?

    Hello! I have an iMac on which runs Leopard. I want to change the name that appears in the bluetooth because it's Apple's Computer and I don't like it. I want to put instead my name. How can I do this? Thanks in advance, Camille

  • Books not downloaded on iBooks

    Books appear dimmed on iPad after purchasing but can't be opened or deleted.How do I overcome

  • Problem with BPE

    I am receiving the following error when sending sync message from an IP (but not always) Error handling for work item 000000736430 Work item 000000736430: Object CL_SWF_XI_MSG_BROKER method SEND_SYNCHRON cannot be executed No exception defined for sy

  • Cannot write to the page lock

    Hi, I keep getting this message when trying to edit my default.aspx page on my ICE enabled site. Could not write the page lock. REason: Could not write data to storage. It is an asp.net page that does not have active content. I fixed the problem caus