• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

HTML Canvas - loading multiple images using xml file

Community Beginner ,
May 17, 2020 May 17, 2020

Copy link to clipboard

Copied

Hi all,
 

I am trying convert an Edge Animate project to Animate CC where single images are loaded into a series of empty movie clips using a frame actions and a xml file. These movie clips are all prepositioned in a single movie clip that has an initiating action to load all the images before playing the timeline and fading up all the images in turn.

I have solved the loading of the images once I have the 'imageid' (MC instance) and 'small_url'. However, I cannot seem to get the data from the XML file into the relevant variables.

the xml is structured like this:

<images>
<imagedata ID = "image1_1">
    <imageid>image1_1</imageid>
    <small_url>images/small/HF0307_008.jpg</small_url>

</imagedata>
<imagedata ID = "image1_2">
    <imageid>image1_2</imageid>
    <small_url>images/small/HF0001_187.jpg</small_url>

</imagedata>
<imagedata ID = "image1_3">
    <imageid>image1_3</imageid>
    <small_url>images/small/HF0226_157.jpg</small_url>

</imagedata>
<images>

The code I have tried with no success is:

var myimageid = "theMovieClipInstanceName";

var imagedata = new XMLHttpRequest(); 

imagedata.addEventListener("load", imagedataF);imagedata.open("GET", "myXMLfile", true);  
imagedata.setRequestHeader("Content-Type", "text/xml");imagedata.send();


function imagedataF(e) { 

var imagedatafile = e.target.responseXML;

//from here is where I am uncertain what to do!!
//I want to identify the xml element with child[0] that = "myimageid" and then set the 'smallurl' variable to this value.

var images = imagedatafile.getElementsByTagName("imagedata");

var smallurl = images.getElementsByTagName("imageid").[0] = myimageid;  

//use variable "smallurl" to load images

}

Been trying everything with no joy.

Any help would be much appreciated.

TOPICS
ActionScript

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 17, 2020 May 17, 2020

try:

var  imageID_array;


function imagedataF(e) {
parser = new DOMParser();
var xml = parser.parseFromString(e.target.response, "text/xml");
myImagesID_array = xml.getElementsByTagName("imagedata");

// and your ith smallurl is myImagesID_array[i].getElementsByTagName("small_url")[0].childNodes[0].nodeValue
}

Votes

Translate

Translate
Community Expert ,
May 17, 2020 May 17, 2020

Copy link to clipboard

Copied

try:

var  imageID_array;


function imagedataF(e) {
parser = new DOMParser();
var xml = parser.parseFromString(e.target.response, "text/xml");
myImagesID_array = xml.getElementsByTagName("imagedata");

// and your ith smallurl is myImagesID_array[i].getElementsByTagName("small_url")[0].childNodes[0].nodeValue
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 19, 2020 May 19, 2020

Copy link to clipboard

Copied

Perfect thanks.

 

Andrew

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2020 May 22, 2020

Copy link to clipboard

Copied

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

I have tried 

var  imageID_array;


function imagedataF(e) {
parser = new DOMParser();
var xml = parser.parseFromString(e.target.response, "text/xml");
myImagesID_array = xml.getElementsByTagName("imagedata");

// and your ith smallurl is myImagesID_array[i].getElementsByTagName("small_url")[0].childNodes[0].nodeValue

The article to grow ps4 jailbreak exploits. This worked for me also. Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

LATEST

you're both welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines