Wondering if someone could give me a hand with this:
I have a swf with a document class attached to it to run a XML driven slideshow. Everything seems to work fine when I go to test movie in flash CS3 but when I upload it to my root directory of the website ethier the XML or the .as document class isnt working because nothing is showing up. Any help with be very appriencated…
Also wondering if someone knows how to change the curr var to play the photos randomly.
package
{
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.Timer;
import fl.transitions.Tween;
import fl.transitions.easing.;
public class slides extends MovieClip
{
var xmlLoader:URLLoader;
var theXML:XML;
var photos:XMLList;
var photoLoader:Loader;
var photoArray:Array;
var fade:Tween;
var curr:Number;
var timer:Timer;
var timey:timeDisplay;
public function slides():void
{
xmlLoader = new URLLoader();
xmlLoader.load(new URLRequest(“photos.xml”));
xmlLoader.addEventListener(Event.COMPLETE, getXML);
photoArray = new Array();
curr = 0;
timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, switchPhoto);
timey = new timeDisplay();
timey.x = 235;
timey.y = 93.5;
}
private function getXML(e:Event):void
{
theXML = new XML(e.target.data);
photos = new XMLList(theXML.photo);
for(var i:int=0;i<photos.length();i++)
{
photoArray.push(photos*.@url);
}
timer.start();
switchPhoto(null);
}
private function switchPhoto(e:TimerEvent):void
{
if(curr < photoArray.length)
{
photoLoader = new Loader();
photoLoader.load(new URLRequest(photoArray[curr]));
curr++;
photoLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
photoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, removeTimey);
}
else
{
curr = 0;
switchPhoto(null);
photoLoader.unload();
}
}
private function showProgress(e:ProgressEvent):void
{
this.addChild(timey);
var perc:Number = Math.floor(e.bytesLoaded / e.bytesTotal * 100);
timey.timerText.text = perc + “%”;
}
private function removeTimey(e:Event):void
{
this.addChild(photoLoader);
fade = new Tween(photoLoader,“alpha”,None.easeNone,0,1,2,true);
}
}
}
So if I have everything in a folder on my desktop, I need to have everything in a folder named the same on my website? If I don’t want a folder should I work with everything without placing them in a folder on my desktop?
Thank you for the random code!
I get this:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///Macintosh%20HD/Users/TOYO/Desktop/Fader%20Movie%202/photos.xml
at slides$iinit()
when I try opening the swf from the site in flash
and when I debug the swf it gives me this:
Attemping to launch and connect to Player using URL /Users/TOYO/Desktop/Movie/slides.swf
[SWF] Users:TOYO:Desktop:Movie:slides.swf - 21433 bytes after decompression
*** Security Sandbox Violation ***
Connection to file:///Users/TOYO/Desktop/Movie/photos.xml halted - not permitted from file:///Users/TOYO/Desktop/Movie/slides.swf
SecurityError: Error #2148: SWF file file:///Users/TOYO/Desktop/Movie/slides.swf cannot access local resource file:///Users/TOYO/Desktop/Movie/photos.xml. Only local-with-filesystem and trusted local SWF files may access local resources.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
at slides$iinit()[/Users/TOYO/Desktop/Movie/slides.as:28]
Cannot display source code at this location.
should I have my publish setting set to acces local files or network in playback?
Thank you mattrock23 I finally got everything working. It was some stupid mistakes in the xml list. I had to put a “…/” in front of “image/image01.jpg”. Also jpg was written as .JPG in the list, had to change it to .jpg to match the actual file format.
Again thank you for helping 
Just realized random isnt working? Any thoughts…
package
{
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.Timer;
import fl.transitions.Tween;
import fl.transitions.easing.;
public class slides extends MovieClip
{
var loader:loader;
var theXML:XML;
var photos:XMLList;
var photoLoader:Loader;
var photoArray:Array;
var fade:Tween;
var curr:Number;
var timer:Timer;
var timey:timeDisplay;
public function slides():void
{
loader = new URLLoader();
loader.load ("http://www.***.com/photos.xml");
loader.addEventListener(Event.COMPLETE, getXML);
photoArray = new Array();
curr = Math.ceil(Math.random() * photoArray.length);
timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, switchPhoto);
timey = new timeDisplay();
timey.x = 235;
timey.y = 93.5;
}
private function getXML(e:Event):void
{
theXML = new XML(e.target.data);
photos = new XMLList(theXML.photo);
for(var i:int=0;i<photos.length();i++)
{
photoArray.push(photos*.@url);
}
timer.start();
switchPhoto(null);
}
private function switchPhoto(e:TimerEvent):void
{
if(curr < photoArray.length)
{
photoLoader = new Loader();
photoLoader.load(new URLRequest(photoArray[curr]));
curr++;
photoLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
photoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, removeTimey);
}
else
{
curr = 0;
switchPhoto(null);
photoLoader.unload();
}
}
private function showProgress(e:ProgressEvent):void
{
this.addChild(timey);
var perc:Number = Math.floor(e.bytesLoaded / e.bytesTotal * 100);
timey.timerText.text = perc + "%";
}
private function removeTimey(e:Event):void
{
this.addChild(photoLoader);
fade = new Tween(photoLoader,"alpha",None.easeNone,0,1,2,true);
}
}
}