[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

04/26/2005 at 08:08AM PDT, ID: 21402881
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Actionscript - XML Slideshow doesn't work.  Possible child parent relationships?

Asked by ingwa in Adobe Flash

Tags: actionscript, xml

Experts, please help.

I am currently using the XML Slideshow Banner script from http://webdevils.com/examples/xml_b...how_banner.html and quite like the display it produces. Thing is I am now using another script (home.swf) to firstly process the xml and if successful include the XML_Slideshow_Banner.swf file, sending the xml stuff to it. This is the code from home.swf:

// Create a new XML object
show.addListener(this);
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load( "/xml/slideshow.xml" );
// Set up onLoad function
my_xml.onLoad = newSlides;
function newSlides( success ) {
if ( success ) {
// Make an array from the xml file
for ( var i = 0; i < this.childNodes.length; i ++ ) {
if ( this.childNodes[i].nodeName == "slideshow" ) {
// Get the wait attribute
wait = Number( this.childNodes[i].attributes.wait );
// get all of the nodes inside of slideshow put them in image_xml
var image_xml = this.childNodes[i].childNodes;
// make a new empty array named image_array
image_array = [];
// Loop through all of the nodes inside image_xml
for( var j = 0; j < image_xml.length; j ++ ) {
// Add a new empty array to the end of image_array
image_array.push( [] );
// Add path as a named element to the array we added above, give it a value from the url attribute in the xml file
image_array[ image_array.length - 1 ][ "path" ] = image_xml[j].attributes.url;
// Add desc as a named element to the array we added above, give it the value of the text node
image_array[ image_array.length - 1 ][ "desc" ] = image_xml[j].firstChild.nodeValue;
}
}
}
//delete mc_slidecontainer;
mc_slidecontainer._x = 5;
mc_slidecontainer._y = 5;

loadMovie("/XML_Slideshow_banner.swf?" + (new Date()).getTime(), mc_slidecontainer);

gotoAndPlay("view");

} else {
trace('problem');
}
};

stop();


Home.swf is processing the above correctly and is loading XML_Slideshow_banner.swf but the problem is it doesn't seem to be sending the xml across. In XML_Slideshow_banner.swf I have the following code:

show.addListener(this);
// Create a new XML object



// Hide the progress bar when we begin
progressbar_mc._visible = 0;

// Start Slide show function
start_slideshow = function() {
count = 0; // Set count to 0, we'll use this to set the depth and instance names for the loaded MCs
image_index = -1; // set image_index to 0, we'll use this to keep track which image from the image_array we are currently displaying.
next_image(); // Call this function each time we want to show the next image from the array
setInterval( next_image, wait * 1000 ); // This will call the function next_image every 10 seconds.
};


// This function loads a new image by attaching a new MC to the stage and loading an image from the image_array
next_image = function() {
count ++; // Advance count by 1
image_index ++; // Advance image_index by 1, so next time around we'll get the next image.
if ( image_index >= image_array.length ) { // Here we should check to see if we have advanced past the last image in the array
image_index = 0; // If so, set image_index back 0 and we start over from the beginning again.
}
slideshow_mc.createEmptyMovieClip( "image_" + count, count ); // Create a new clip to load the new image into
slideshow_mc[ "image_" + count ].loadMovie( image_array[ image_index ].path ); // load a jpg from the image array
slideshow_mc[ "image_" + count ]._alpha = 0; // Hid this clip by setting it's alpha to 0, we'll animate the alpha later to show it after it loads.
show_loader( slideshow_mc[ "image_" + count ] ); // Show the progress bar, this function needs to know which clip to monitor as it loads so we pass the name of the clip as a paramter.
hide_display(); // Hide the display_mc, this shows the text.

};


next_image_ready = function() { // When our image loads it will call this function
slideshow_mc[ "image_" + count ].onEnterFrame = function() { // Assign the newest MC a function to animate it's alpha property
this._alpha += 10; // Each fram add 10 to the alpha property, set the speed of the animation here
if ( this._alpha >= 100 ) { // if alpha is 100 or greater we are done with the animation
image_done(); // Call image_done()
this.onEnterFrame = null;// Delete this function
};
};
};

image_done = function() { // The cycle is complete the new image has finished loading
slideshow_mc[ "image_" + ( count - 1 ) ].removeMovieClip(); // Remove the last image loaded, it should be hidden behind the most recent image loaded.
};


show_loader = function( watch_target ) { // Call this to show the progress bar, pass the MC to watch.
progressbar_mc._visible = 1; // Show the progressbar_mc
progressbar_mc.bar_mc._xscale = 0; // Set the bar_mc, inside of progressbar_mc, _xscale to 0.
progressbar_mc.load_target = watch_target; // Save the MC to watch in a variable
progressbar_mc.onEnterFrame = function() { // This enterFrame function will monitor the loading process every frame.
var b = this.load_target.getBytesLoaded(); // get bytes loaded
var t = this.load_target.getBytesTotal(); // get bytes total
if ( t > 100 ) { // Wait til total shows a value to check for error
this.bar_mc._xscale = ( b / t ) * 100; // Set the _xscale of the bar based on % of bytes loaded.
if ( b == t ) { // when bytes loaded equals total bytes we are finished loading.
next_image_ready(); // This is image is ready to show now
show_display( image_array[ image_index ].desc );
this._visible = 0; // Hide the progress bar
this.onEnterFrame = null; // delete this enterFrame function
}
}
};
};
// As an experiment I called the show_loader function here and passed the xml object
// When the movie opens the loader shows and monitors the loading of the xml file.
show_loader( my_xml );

show_display = function( theText ) {
_parent.mc_captions.myCaption.text = theText;
_parent.mc_captions.onEnterFrame = function() {
this._alpha += 10;
if ( this._alpha >= 100 ) {
this.onEnterFrame = null;
}
};
};

hide_display = function() {
_parent.mc_captions.onEnterFrame = function() {
this._alpha -= 10;
if ( this._alpha <= 0 ) {
this.onEnterFrame = null;
}
};
};

As you can see, I have removed function newSlides( success ). But it's not working.

I really need to be able to parse different xml files to XML_Slideshow_banner.swf as I have developed a content management system which will be used to edit the xml and depending on which section you are in depends on which xml file is being used. Please could someone help me. I'm at my wits end.

BTW, if I process the first function in home.swf which then pulls the XML_Slideshow_banner.swf (which also contains the same function and call to the xml file) it works. It's when I want to push the xml across that it seems to break.

Thank you very much for any help that can be provided.

Mark
[+][-]04/26/05 04:12 PM, ID: 13871599

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/27/05 01:06 AM, ID: 13873871

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 01:37 AM, ID: 13873991

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/27/05 05:36 AM, ID: 13875381

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 07:35 AM, ID: 13876539

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Adobe Flash
Tags: actionscript, xml
Sign Up Now!
Solution Provided By: negatyve
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04/27/05 08:08 AM, ID: 13876906

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 08:37 AM, ID: 13877285

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 08:55 AM, ID: 13877522

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/27/05 09:49 AM, ID: 13878170

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 12:07 PM, ID: 13879431

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 12:09 PM, ID: 13879445

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/27/05 12:16 PM, ID: 13879518

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91