Hello,
First of all, the code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
lb.addEventListener(Event.CHANGE, itemChange);
function itemChange(e:Event):void
{
ta.source = lb.selectedItem.data;
}
var xml:XML;
function onLoaded(e:Event):void
{
xml= new XML(e.target.data);
var il:XMLList = xml.dave.movie;
for(var i:uint=0; i<il.length(); i++)
{
lb.addItem({data:il.href.text()*,
label:il.gary.text()*});
}
}
loader.load(new URLRequest("xml.xml"));
As of right now, i can manually select and play swfs no problem. I followed a great tutorial on gotoandlearn, which got me up to speed on how CS3 handles XML. My question is two-fold. 1) How can I get the first node to start playing right away, and then how can I get them to loop? thanks a lot guys!
Ha ha that looks very fimilar.
you would do it like this.
added code is in bold
/*sets the change to go off every 5 seconds timer is set in ms (1000 = 1 second) */
**var swichTimer:Timer = new Timer(5000);
swicthTimer.addEventListener (TimerEvent.TIMER, autoChange);
function autoChange (event:TimerEvent):void
{
/* this is set up to handle 11 entrys in you list just change the number accordingly*/
if (lb.selectedIndex!=10)
{
lb.selectedIndex++;
} else if (lb.selectedIndex>=10)
{
lb.selectedIndex = 0;
}
}**
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
lb.addEventListener(Event.CHANGE, itemChange);
function itemChange(e:Event):void
{
ta.source = lb.selectedItem.data;
}
var xml:XML;
function onLoaded(e:Event):void
{
xml= new XML(e.target.data);
var il:XMLList = xml.dave.movie;
for(var i:uint=0; i<il.length(); i++)
{
lb.addItem({data:il.href.text()*,
label:il.gary.text()*});
}
**
/* sets selected index to 0 and selected item to 0 */
lb.selectedItem = 0;
lb.selectedIndex = 0;
**
** switchTimer.start();**
}
loader.load(new URLRequest("xml.xml"));
Thanks! I had to tweak it a little for some custom stuff were doing but you solved a big chunk. Thanks again.
one last thing, that I can’t figure out.
var itemCount = 0;
box.text= itemCount;
var switchTimer:Timer = new Timer(5000);
switchTimer.addEventListener (TimerEvent.TIMER, autoChange);
function autoChange (event:TimerEvent):void
{
if (lb.selectedIndex!=itemCount)
{
lb.selectedIndex++;
} else if (lb.selectedIndex>=itemCount)
{
lb.selectedIndex = 0;
}
ta.source = lb.selectedItem.data;
}
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
lb.addEventListener(Event.CHANGE, itemChange);
//lb.addEventListener(Event.RENDER, itemChange);
function itemChange(e:Event):void
{
ta.source = lb.selectedItem.data;
}
var xml:XML;
function onLoaded(e:Event):void
{
xml= new XML(e.target.data);
var il:XMLList = xml.dave.movie;
itemCount = il.length()-1;
for(var i:uint=0; i<il.length(); i++)
{
lb.addItem({data:il.href.text()*,
label:il.gary.text()*});
}
/* sets selected index to 0 and selected item to 0 */
lb.selectedItem = 0;
lb.selectedIndex = 0;
switchTimer.start();
}
loader.load(new URLRequest("xml.xml"));
This first time it hits the 1st node (this this case, “swf”) it doesn’t play, but when it refreshes back to the beginning, it plays fine. Any thoughts?
not sure why its not starting on the first loop. It works fine for me
weird. i emailed it to a co worker that has flash and he’s having the same problem. one of our developers (doesn’t really know flash) told me that it might have something to do with the itemChange not updating. I can’t for the life of me figure it out 
can you send me a moc file? maby i can figure it out if i see the whole thing