hello!
i seem to have my paths a little bit crossed in a site im making.
am trying to make a slideshow in my swf that is told by my xml file which jpgs to use etc.
i found one and it works fine alone. however when i try to tie it in with the rest of my site something goes wrong.
here is my code for the slideshow:
import mx.transitions.Tween;
import mx.transitions.easing.*;
import mx.xpath.XPathAPI;
var delay:Number;
var animationDuration:Number;
var current_num:Number = 0;
var first_num:Number = 0;
var image_holder:MovieClip = this.createEmptyMovieClip("image_holder", this.getNextHighestDepth());
var mcl_lis:Object = new Object();
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(mcl_lis);
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
if( isLoaded )
{
data_arr = XPathAPI.selectNodeList(this.firstChild,"Slideshow/images/image");
delay = parseInt(XPathAPI.selectSingleNode(this.firstChild ,"Slideshow/settings/delay").firstChild);
animationDuration = parseInt(XPathAPI.selectSingleNode(this.firstChild ,"/animationDuration").firstChild);
//optional code to check delay and animationDuration values
//(delay == undefined || delay == null) ? delay = 5000: delay<1000? delay =1000:true;
//(animationDuration == undefined || animationDuration == null) ? animationDuration = .8: animationDuration<.3? animationDuration =.8:true;
load_image();
}else
{
trace("XML Load error");
}
}
xml.load("xml/data.xml")
function load_image()
{
mcl.loadClip(data_arr[current_num].attributes.url, image_holder);
(current_num>=data_arr.length-1) ? current_num = first_num:current_num++;
}
mcl_lis.onLoadInit = function(target_mc:MovieClip) {
var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 0, 100, .5, true);
setTimeout(function(){
var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 100, 0, .5, true);
obj.onMotionFinished = function() {load_image();};
},5000);
};
- import mx.transitions.Tween;
- import mx.transitions.easing.*;
- import mx.xpath.XPathAPI;
- var delay:Number;
- var animationDuration:Number;
- var current_num:Number = 0;
- var first_num:Number = 0;
- var image_holder:MovieClip = this.createEmptyMovieClip("image_holder", this.getNextHighestDepth());
- var mcl_lis:Object = new Object();
- var mcl:MovieClipLoader = new MovieClipLoader();
- mcl.addListener(mcl_lis);
- var xml:XML = new XML();
- xml.ignoreWhite = true;
- xml.onLoad = function( isLoaded:Boolean )
- {
- if( isLoaded )
- {
- data_arr = XPathAPI.selectNodeList(this.firstChild,"Slideshow/images/image");
- delay = parseInt(XPathAPI.selectSingleNode(this.firstChild ,"Slideshow/settings/delay").firstChild);
- animationDuration = parseInt(XPathAPI.selectSingleNode(this.firstChild ,"/animationDuration").firstChild);
- //optional code to check delay and animationDuration values
- //(delay == undefined || delay == null) ? delay = 5000: delay<1000? delay =1000:true;
- //(animationDuration == undefined || animationDuration == null) ? animationDuration = .8: animationDuration<.3? animationDuration =.8:true;
- load_image();
- }else
- {
- trace("XML Load error");
- }
- }
- xml.load("xml/data.xml")
- function load_image()
- {
- mcl.loadClip(data_arr[current_num].attributes.url, image_holder);
- (current_num>=data_arr.length-1) ? current_num = first_num:current_num++;
- }
- mcl_lis.onLoadInit = function(target_mc:MovieClip) {
- var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 0, 100, .5, true);
- setTimeout(function(){
- var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 100, 0, .5, true);
- obj.onMotionFinished = function() {load_image();};
- },5000);
- };
is there someplace i can add or change my path.
i have a file named preloader.swf with a main menu with 4 options. when you choose one it goes to an mc called news.(still however preloader.swf). there in my news comes an xml based list and from that list one should click on a lits item and get the relevant slideshow.
thank you
Moderator Remark: added [code] tags