I downloaded this excellent tutorial and I’m trying to modify it to my needs. Problem is, the second I start getting into the code, it no longer works.
Here’s is what I’m trying to accomplish…
When an item is clicked in the list box, I’d like it to open a URL.
And a second variation to that would be to have multiple URLs assigned to each listbox item. A radio box would determine which URL to use.
Hey, I’m not laughing at all, as a matter of fact you’re almost there
Let’s have a look at your mistakes:[list][]list.addItem(“ABC”, artisturl(“http://www.abcmartinfry.com”));
I’m guessing you’re putting artisturl because I put Date in the tute. The thing is, you have to declare a Date object that way. But this is very specific. In your case, all you need is the string containing the URL.
[]The launchSite function has to take as a parameter the current component (let’s call it “c”). Then you need to get the “data” part from the selected item, which is here the second argument you put in the addItem command. And then you getURL that URL.[/list]So if you have a listbox called list on the scene, you’ll have to put that kind of code:
list.addItem("ABC", "http://www.abcmartinfry.com");
list.addItem("A-Ha", "http://www.a-ha.com");
function launchSite(c){
var j = c.getSelectedItem().data;
getURL(j,"_blank");
}
list.setChangeHandler("launchSite");
I have been trying to accomplish this task forever.
I’m going to work on the next variation and see if I can get it. I’m going to have multiple URLs per item and see if I can get the different data based on a radio button or popup (URL, CDs, Vinyl, DVD).
I’ll make a standalone version that my listeners can download. That will have a little more ‘flare’.
Quick question about XML. There is link that I can use to retreive the currently playing song for my webcast in XML format. I read something about Flash not being able to retrieve data across domains.
Does this mean I wouldn’t be able to use Flash to display my currently playing song?