Skip to main content
Known Participant
July 6, 2009
Question

Add URL to XML Flash Images

  • July 6, 2009
  • 1 reply
  • 2443 views

Hi there,

I have a xml driven flash movie where I need to be added URL from the XML file. Can someone modify it for me, please?

Here are the codes:

AS CODE:


myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    //portfolioTag = this.firstChild;
    numimages = this.firstChild.childNodes.length;
    spacing = 100;
     this.counter = 0;
    for (i=0; i<numimages; i++) {
        this.picHolder = this.firstChild.childNodes;
        this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
        this.thumbHolder._y = i*spacing;
        this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
        this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
        this.thumbHolder.title = this.picHolder.attributes.title;
        this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
        };
    }
};
myPhoto.load("service.xml");

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

XML CODE:

<gallery>
<image thmb="thumbnails/image2.jpg"/>

</gallery>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Thanks a lot,

Beko

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 6, 2009
use:


myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    //portfolioTag = this.firstChild;
    numimages = this.firstChild.childNodes.length;
    spacing = 100;
     this.counter = 0;
    for (i=0; i<numimages; i++) {
        this.picHolder = this.firstChild.childNodes;
        this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
        this.thumbHolder._y = i*spacing;
        this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
        this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
        this.thumbHolder.title = this.picHolder.attributes.title;
        this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
        };
    }
};
myPhoto.load("service.xml");

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >

XML CODE:

<gallery>
<image thmb="thumbnails/image2.jpg" title="your title" main="your url"/>

</gallery>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <

Thanks a lot,

Beko

beko75Author
Known Participant
July 6, 2009

kglad,

Thanks for your quick replies again, but the url doesn't seem to work on the image : ( Any idea what might be?

Thanks,

Beko

July 6, 2009

You are asking to do your job, it's amazing. kglad don't know what you want so he tried something blindly:

this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
        };

This is to load the URL of a movie into the loader. But you may want to open a new window with this URL, do do like:

this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            getURL(this.main,'_blank');
        };

But you got to do your part of the job, you're the only one here knowing what you want to do with your URL.