Load images via xml/parameters, and assign URL

Hi All
I am trying to do a simple gallery that will loop around
three images or so
and when you click on them the page goes to a given URL.
I found a generic example gallery, that reads the image
sources in from an
XML file but it does not have an event attached to it for the
initial click.
The code is this (looping around each node of XML):
imageData = new Object;
imageData.path = imageNode.attributes.path;
imageArray[s]=imageData;
imageNode = imageNode.previousSibling;
I have tried putting:
imageData.href = "
http://www.google.com";
imageData.url = "
http://www.google.com";
But to no avail.
Does anybody have any suggestions or ideas?
Many thanks
Darren

create arrays that contain the same info as the xml.
p.s.  and, you'll use attachMovie() instead of loadMovie().

Similar Messages

  • Problem loading Image through XML!

    Hi,
      I am Akshay and am beginner in this forum. I am trying to load images using flickr API and having problem.
    I am doing it in following fashion:
    1) I am calling the Httpservice to get the xml through flickr API as
    <s:HTTPService id="photoService" url="http://api.flickr.com/services/feeds/....FullAPI" resultFormat="e4x" result="photoResultHandler(event);" fault="photoFaultHandler(event);"/>
    2) In photoResultHandler I am retrieving the XML
    private function photoResultHandler(re:ResultEvent):void
    photoXml= re.result as XML;
    However, I am struggeling to retireve elements from photoXML and then use it to display image in :
    <mx:Image  id="img0" x="151" y="98" width="520" height="291"/>
    The XML structure is as below:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <feed">
    <entry>
         <author>  </author>
         <link rel="enclosure" type="image/jpeg" href="http://farm5.static.flickr.com/4484460580_04bbced2d8_o.jpg"/>
    </entry>
    <entry>
    </entry>
    I need to load the href value of link  which can be found in feed-->entry-->link in the above xml.
    Please help!
    -Akshay

    Hello Dave,
       Thanks for your prompt reply. Here's the mxml code :
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" creationComplete="photoService.send()"  minHeight="600">
    <fx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    import mx.events.MoveEvent;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    public var photoXml:XML;
    private function photoResultHandler(re:ResultEvent):void
    photoXml= re.result as XML;
    //var src :int =  "{photoXml.feed.entry.updated}" as int;
    img0.source= String(photoXml.entry[0].link[1].@href);
    private function photoFaultHandler(fe:FaultEvent):void
    Alert.show(fe.fault.message);
    ]]>
      </fx:Script>
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:HTTPService id="photoService" url="http://api.flickr.com/services/feeds/photos_public.gne?id=48951865@N07" resultFormat="e4x" result="photoResultHandler(event);" fault="photoFaultHandler(event);"/>
    </fx:Declarations>
    <mx:Image  id="img0" x="151" y="98" width="520" height="291"/>
    </s:Application>
    Hope it helps you in finding out the problem...DO let me know your thouhgts
    Thanks again for your replies so far......
    -Akshay

  • How to load images using xml in flash

    Hi
    im working on a quiz project where i plan to load images using xml in to flash, can any one help with the script with AS2 or 3

    You'll find a tutorial for what you are after here:
    http://www.gotoandlearn.com/play?id=22

  • How to load external png image via xml?

    Can anyone help me with adding a png image to a mc with an instance name.
    I only want to display a single image (no gallery)
    I would like to get the url for the image via an xml.
    Here is a copy of my current action script which has already pulled in the xml data which includes the node with the url for the photo.
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    var myXML:XML;
    var myLoader:URLLoader = new URLLoader();
    myLoader.load(new URLRequest("links.xml"));
    myLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void
        myXML = new XML(e.target.data);
        trace(myXML);
        menumv.carbtn.addEventListener(MouseEvent.CLICK, openCURL);
        menumv.edubtn.addEventListener(MouseEvent.CLICK, openEURL);
        menumv.psybtn.addEventListener(MouseEvent.CLICK, openPURL);
        menumv.stubtn.addEventListener(MouseEvent.CLICK, openSTURL);
        menumv.busbtn.addEventListener(MouseEvent.CLICK, openBURL);
        menumv.shabtn.addEventListener(MouseEvent.CLICK, openSURL);
        studentmv.stuname.text = myXML.student.name;
    function openCURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.car.url));
    function openEURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.edu.url));
    function openPURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.psy.url));
    function openSTURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.stu.url));
    function openBURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.bus.url));
    function openSURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.sha.url));
    And here is a copy of the node containing the url
    <menu>
        <student>
        <name>testnamehere</name>
        <photo>http://10.0.0.2/test/photos/testnamephoto.jpg</photo>
        </student>
    </menu>
    I did see this tutorial but it was for a gallery and I couldnt seem to hack and slash it to do what I want.
    http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/
    Thanks again in advance for all the help.

    I have added that code but I think i have buggered up something else in the process.
    I get the following error
    ReferenceError: Error #1069: Property data not found on flash.display.LoaderInfo and there is no default value.
        at sdp_fla::MainTimeline/load_complete()
    Current AS
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    var myXML:XML;
    var myLoader:URLLoader = new URLLoader();
    myLoader.load(new URLRequest("links.xml"));
    myLoader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void
        myXML = new XML(e.target.data);
        trace(myXML);
        menumv.carbtn.addEventListener(MouseEvent.CLICK, openCURL);
        menumv.edubtn.addEventListener(MouseEvent.CLICK, openEURL);
        menumv.psybtn.addEventListener(MouseEvent.CLICK, openPURL);
        menumv.stubtn.addEventListener(MouseEvent.CLICK, openSTURL);
        menumv.busbtn.addEventListener(MouseEvent.CLICK, openBURL);
        menumv.shabtn.addEventListener(MouseEvent.CLICK, openSURL);
        studentmv.stuname.text = myXML.student.name;
    var _request:URLRequest = new URLRequest(myXML.student.photo);
    var _ldr = new Loader();
    studentmv.photo.addChild(_ldr);
    _ldr.load(_request);
    _ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, load_complete, false, 0, true);
    function openCURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.car.url));
    function openEURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.edu.url));
    function openPURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.psy.url));
    function openSTURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.stu.url));
    function openBURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.bus.url));
    function openSURL(e:MouseEvent):void
            navigateToURL(new URLRequest(myXML.sha.url));
    function load_complete(event):void
    var bitmap:Bitmap = Bitmap(event.currentTarget.data);
    bitmap.smoothing = true;
    bitmap.width = studentmv.photo.width
    bitmap.width = studentmv.photo.height
    studentmv.photo.addChild(bitmap)

  • Trouble loading images from XML files using AS

    I am creating a slideshow and found a script that will load
    the images via an XML document, but I believe the script is for an
    absolute references image such as <a href="
    http://www.myimages.com/image1.jpg">
    and I want to be able to have them in a file and reference the file
    in the XML such as :
    <pic>
    <image>images/04_02.jpg</image>
    <caption>Soleil Center 4</caption>
    </pic>
    When I test movie I get an error
    Error opening URL "path_to_image/01_02.jpg"
    Is there something I need to change in the AS to be able to
    reference a folder on my desktop (in the same directory as .fla
    file).
    here is the AS code:
    function loadXML(loaded) {
    if (loaded) {
    xmlNode = this.firstChild;
    image = [];
    description = [];
    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {
    image
    = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
    description
    = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
    firstImage();
    } else {
    content = "file not loaded!";
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    desc_txt.text = description[0];
    picture_num();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    }

    something is still amiss here becuase I placed the xml and
    images at the root level and the images still do not load. I don't
    get any kind of error and Trace tells me the file is being loaded.
    took out the /images/ part so that in the XML it's now :
    <pic>
    <image>07_02.jpg</image>
    <caption>Image Description</caption>
    </pic>
    and here is the AS code:
    var image:Array = new Array();
    var description:Array = new Array();
    function loadXML(loaded) {
    if (loaded) {
    var xmlNode:XMLNode = this.firstChild;
    var total:Number = xmlNode.childNodes.length;
    for (var i:Number = 0; i<total; i++) {
    image.push(xmlNode.childNodes
    .childNodes[0].firstChild.nodeValue);
    description.push(xmlNode.childNodes.childNodes[1].firstChild.nodeValue);
    trace('File Name Value: '+xmlNode.childNodes);
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    desc_txt.text = description[0];
    picture_num();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    }

  • How can I load images without XML, please?

    Hello Everyone,
    I would highly appreciate it if someone can point me into the right direction. I have some AS2 code which loads up the images via an xml file. I have been asked to eliminate XML entirely and have images be loaded from with in the library. Aside from images, there are other xml nodes such as:
    image_name, image_description and such.
    What would be the best way going about eliminating the XML and getting the code to load images and other related info from the library. I would highly appreciate your help on this, please.
    Thanks a lot.

    create arrays that contain the same info as the xml.
    p.s.  and, you'll use attachMovie() instead of loadMovie().

  • Load images from XML to specific movieclip

    I'm still begginer. I have to load images in specific movieclip, because they're loading over all the other layers. What should I do?
    I made a simple slideshow by tutorial.
    I guess it would be better that I show all the code not specific parts:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    var my_speed:Number;
    var my_total:Number;
    var my_images:XMLList;
    var my_loaders_array:Array=[];
    var my_labels_array:Array=[];
    var my_success_counter:Number=0;
    var my_playback_counter:Number=0;
    var my_slideshow:Sprite = new Sprite();
    var my_image_slides:Sprite = new Sprite();
    var my_label_slides:Sprite = new Sprite();
    var my_preloader:TextField;
    var my_timer:Timer;
    var my_prev_tween:Tween;
    var my_tweens_array:Array=[];
    var my_xml_loader:URLLoader = new URLLoader();
    my_xml_loader.load(new URLRequest("sshow.xml"));
    my_xml_loader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void {
        var my_xml:XML=new XML(e.target.data);
        my_speed=my_xml.@SPEED;
        my_images=my_xml.IMAGE;
        my_total=my_images.length();
        loadImages();
        my_xml_loader.removeEventListener(Event.COMPLETE, processXML);
        my_xml_loader=null;
    function loadImages():void {
        for (var i:Number = 0; i < my_total; i++) {
            var my_url:String=my_images[i].@URL;
            var my_loader:Loader = new Loader();
            my_loader.load(new URLRequest(my_url));
            my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
            my_loaders_array.push(my_loader);
        my_preloader = new TextField();
        my_preloader.text="Loading";
        my_preloader.autoSize=TextFieldAutoSize.CENTER;
        my_preloader.x = (stage.stageWidth - my_preloader.width)/2;
        my_preloader.y = (stage.stageHeight - my_preloader.height)/2;
        addChild(my_preloader);
    function onComplete(e:Event):void {
        my_success_counter++;
        if (my_success_counter==my_total) {
            startShow();
        var my_loaderInfo:LoaderInfo=LoaderInfo(e.target);
        my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
    function startShow():void {
        removeChild(my_preloader);
        my_preloader=null;
        addChild(my_slideshow);
        my_slideshow.addChild(my_image_slides);
        nextImage();
        my_timer=new Timer(my_speed*1000);
        my_timer.addEventListener(TimerEvent.TIMER, timerListener);
        my_timer.start();
    function nextImage():void {
        var my_image:Loader=Loader(my_loaders_array[my_playback_counter]);
        my_image_slides.addChild(my_image);
        my_image.x = (stage.stageWidth - my_image.width)/2;
        my_image.y = (stage.stageHeight - my_image.height-20)/2;
        my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
    function timerListener(e:TimerEvent):void {
        hidePrev();
        my_playback_counter++;
        if (my_playback_counter==my_total) {
            my_playback_counter=0;
        nextImage();
    function hidePrev():void {
        var my_image:Loader=Loader(my_image_slides.getChildAt(0));
        my_prev_tween=new Tween(my_image,"alpha",Strong.easeOut,1,0,2,true);
        my_prev_tween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut);
    function onFadeOut(e:TweenEvent):void {
        my_image_slides.removeChildAt(0);

    I don't see a problem in the code you provided. All the pictures are put in single one MovieClip, my_image_slides. Of course, there can be only one DisplayObject in a DisplayObjectContainer's layer (depth), so when you call function addChild again and again, the child displayObjects keep stacking up one on the other. I found one strange thing though:
    my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
    Why would you create an array just to limit it to one item and overwrite it every time? I would use this instead:
    my_tweens_array.push(new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true));
    Can you upload it somwhere so we can see it in action? At this point I can only guess what the problem is.

  • How could I load image via a Form when it is in runtime by not using default block

    1. How could I load image from my local computer to the database via a Form when it is in runtime?
    2. And how to display the image stored in the database on a Form ?
    Thanks buddy ~
    A nice member answered this question already, but I want to know how could I do it by using manual create block instead of using database item directly~
    Could anyone help me pls~

    This is the only way I know right now:
    1) Create this table
    SQL> desc av_data
    Name Null? Type
    BLOB_ID NOT NULL NUMBER(10)
    BLOB_TYPE NOT NULL VARCHAR2(10)
    DESCRIPTION NOT NULL VARCHAR2(25)
    BLOB_DATA LONG RAW
    2) On form create a button with this 'when-btn-prssed' tgr:
    DECLARE
         v_dirname          VARCHAR2(255);
         v_filename          VARCHAR2(255);
    BEGIN
         v_dirname := 'C:\';
         v_filename := get_file_name(v_dirname, NULL,
         'Bitmap file (*.bmp)|*.bmp|'                    ||
         'JPEG file (*.jpg)|*.jpg|'          );
         IF v_filename IS NOT NULL THEN
    read_image_file(v_filename, 'ANY',
    'av_data_image.blob_data');
         END IF;
    END;     
    3) Add this pre-insert trigger too :
    :av_data_image.blob_type := 'IMAGE';
    Sorry if this is not exactly the answer you're looking for.
    Bob

  • Loading images in a table and show this image in a html form

    Hi All,
    I'am a newbie in Oracle and PL/SQL.
    I need to load a image in a table and restrive this image and show it in a html form. I'd like to use a PL/SQL procedure.
    Thanks in advance for any suggestions.

    Hi,
    This forum is for Oracle9iAS Web Services discussion.
    I would recommend that you post your question to the 9iAS - General discussion forum.
    Regards,
    Tim

  • Loading video via xml

    I am trying to build a simple applications driven by a flat
    xml file and adobes spry framework. I am developing a news console
    that supports video. Here is what I am trying to do:
    I have an xml file which list various parts of the "news
    console" eg. headline, story, video ect.
    The video however is hosted through vimeo. Is there a way to
    embed video that is hosted on another site through xml and have it
    appear on an html page? How would I go about doing this?
    I tried placing the embed code form vimeo using cdata but all
    that does is make the code appar on the page and not the actual
    video.
    I would really like it if someone could steer me in the right
    direction.
    Thanks

    the swftools module in Drupal has a generic player that only has autoplay available. Since my client wishes not to have the videos autoplay, installed and configured another video player module called Flowplay, but apparently that has issues with xml.
    So I've installed and configured another module called JW Player. I can set this up on the server that the Drupal install is on, but when I try to get a video to play using
    "xmlPath: "http://www.mydomain.com/feeds/video/93/detail.xml", it won't play it.
    If I put a video on the same site as the Drupal install, it finds it and plays it with the JW skin. My client will want to use the other more appealing video player skin.
    Also I think the code "swfPath: "http://www.mydomain.com/videos/swfs", may call the skin and some options that appear after the video has played. Both xml's don't seem to work. Investigating this is when I found out about Flash's problem with xml being used when more than one server is used.
    so there are 4 things workinghere: Drupal, Flash, xml and javaScript. It's complicated. maybe it makes sense to see if the code I'm using (the xml) is right. the videos were playing before so the xml was getting to the other server. that's what puzzles me. thanks, any ideas?

  • 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.

  • I'd like to load images using XML and Java - hints??

    I have a XML files that are created on a timed basis....they describe a photo and point to a dir where the photo is stored...like...
    <image>
    <user>bill</user>
    <img>photo.jpg</img>
    <img_dir>'/tmp/photos'</img_dir>
    </image>
    I'd like to write a Java program that parses the XML and loads the images, data into Oracle.
    Suggestions on Oracle tools, downloads that will help me accomplish this???
    Thanks!

    I pass a URL and then when I parse the XML I download the file from the URL.
    A.

  • Can't load images under Linux with JavaFX img url

    I have a simple Imageview
    ImageView {
    x: bind mouseX
    y: 200
    //fitWidth works better than transforms
    fitWidth: 200;
    fitHeight: 200;
    image: bind img
    //transforms: [
    // Scale {x: bind myScaleX, y: bind myScaleY}]
    //Reflection effect
    effect: Reflection {
    bottomOpacity: 0.0
    topOpacity: 0.8
    fraction: 1.0
    topOffset: bind mouseY/5
    and I am loading the image like this in anoter function:
    img = Image {
    url: "file://home/suvi/NetBeansProjects/viewfx/src/viewfx/pictures/pic2.jpg"
    //url: "file:/D:/My Documents/NetBeansProjects/ViewFX/src/viewfx/pictures/pic2.jpg"
    //url: "{__DIR__}pictures/pic2.jpg"
    it works under Windows like line 2. Line 3 works under Windows and Linux,
    but Line 1 does not load a image under Linux ?!?
    What is the reason for that? any help?

    Hi raychen and Company
    ok, this is big trouble. I tested it under Windows XP SP3 and Fedora 12.
    The Image URL does not work equal under both system
    Windows: url: "file:/
    Linux: url "file://
    so much for the Java VM makes it system independable, NOT.
    Any workaround?
    Where can I fill a JavaFX Bugreport?

  • How to have smooth fade effect between the two images via XML

    I have my xml gallery working fine, all i need is to have a smooth fade effect between the two images, right now they are changing with a jerk. Can somebody help me getting this effect with my code. Any help is much appreciated.
    function loadXML(loaded) {
        if (loaded) {
            xmlNode = this.firstChild;
            image = [];
            link = [];
            thumbnails = [];
            thumbnailsOn = [];
            total = xmlNode.childNodes.length;
            for (i=0; i<total; i++) {
                image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
                link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
                thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
                thumbnailsOn[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
                thumbnails_fn(i);
            firstImage();
            loopPlay();
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("data.xml");
    thumbnail_mc.attachMovie("prev", "prev_new", 1);
        thumbnail_mc.prev_new._x= -20;
        thumbnail_mc.prev_new._y= -1;
    thumbnail_mc.attachMovie("next", "next_new", 4);
    thumbnail_mc.next_new._y= -1;
        //thumbnail_mc.next_new._x= -30;
    thumbnail_mc.prev_new.onRelease = function() {
        prevImage();
    thumbnail_mc.next_new.onRelease = function() {
        nextImage();
    p = 0;
    this.onEnterFrame = function() {
        filesize = holder.getBytesTotal();
        loaded = holder.getBytesLoaded();
        //preloader._visible = true;
        if (loaded != filesize) {
            preloader.preload_bar._xscale = 100*loaded/filesize;
        } else {
            preloader._visible = false;
            if (holder._alpha<100) {
                holder._alpha += 10;
    function nextImage() {
        if (p<(total-1)) {
            p++;
            if (loaded == filesize) {
                holder._alpha = 0;
                holder.loadMovie(image[p], 1000);
                //desc_txt.text = description[p];
                picture_num();
    click._alpha=0;
    click.onRelease = function() {
        getURL(link[p], "_blank");
        loopStop();
    function HoldImage() {
        nextImage();
        clearInterval(myTimer2);
        loopPlay();
    function checkImageState() {
        if (p==total-1) {
            p = -1;
        if (loaded==filesize) {
            clearInterval(myTimer1);
            myTimer2 = setInterval(HoldImage,3000);
    function loopPlay() {
        myTimer1 = setInterval(checkImageState, 3000);
    function loopStop() {
        clearInterval(myTimer1);
        clearInterval(myTimer2);
    function prevImage() {
        if (p>0) {
            p--;
            holder._alpha = 0;
            holder.loadMovie(image[p], 1000);
            target_mc._alpha = 40;
            picture_num();
    function firstImage() {
        if (loaded == filesize) {
            holder._alpha = 0;
            holder.loadMovie(image[0], 1000);
            picture_num();
    function picture_num() {
        current_pos = p+1;
    function thumbnails_fn(k) {
        thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
        tlistener = new Object();
        tlistener.onLoadInit = function(target_mc) {
            target_mc._x = (target_mc._width+10)*k;
            target_mc.pictureValue = k;
            target_mc.onRelease = function() {
                p = this.pictureValue-1;
                nextImage();
            target_mc.onRollOver = function() {
                this._alpha = 40;
            target_mc.onRollOut = function() {
                this._alpha = 100;
        image_mcl = new MovieClipLoader();
        image_mcl.addListener(tlistener);
        image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);       

    I have a center of energy program similar to the one used by IMAQ. I have attached an example using your data. I first found the center of the entire image. Then I split the array in two and found the centers of each half. That gives you the position of the two spots. This program won't work if the spots are too close to each other or are separeted in the other axis.
    Attachments:
    distance between two spots one direction.vi ‏1096 KB
    Center of energy calc.vi ‏40 KB

  • Load IMAGE from XML

    XML:
    private var myBooks:XML =
    <books>
    <book>
    <title>Something</title>
    <price>$0.00</price>
    <source>assets/image1.jpg</source>
    </book>
    </books>
    MXML for image:
    <mx:Image x="272" y="1" width="375" height="338"
    source="{myBooks.book[selectedBookIndex].source}"/>
    Am I doing this right? I can load all my data into textfields
    but i can not get the product image to load.
    Thanks again!

    Looks ok. Verify your relative url. Try it with an absolute
    url.
    Hmm, are you getting any compiler warnings? Abou square
    brackets?
    Tracy

Maybe you are looking for