PDA

View Full Version : [AS2] using external images as icons for flash list component


deeh
12-08-2008, 08:53 PM
I've created a custom flash video player with a
xml generated playlist using actionscript 2 and the
flash list component. I want to insert icons in each row
of the list next to each video description. These icons aren't symbols
located in the library, they are external images located in the same folder
as the video player. The video description, url and image location are
imported from an XML file structured like this:

<videos>
<video url="thevideo.flv" desc="The description." img="thumbs/video_thumb.gif" />
</videos>

The XML data is imported into the list
component using actionscript 2.0 like this:



var vlist:XML = new XML();
vlist.ignoreWhite = true;
vlist.load("the_video_playlist.xml");

vlist.onLoad = function() {
var videos:Array = this.firstChild.childNodes; //will take all video tags in xml file and put into array

videoList.iconField="icon";

for (i=0;i<videos.length;i++) {

var labelItem:String = videos[i].attributes.desc; //video description
var dataItem:String = videos[i].attributes.url; //video url
var imageItem:String = videos[i].attributes.img; //thumb URL

videoList.addItem({label:labelItem, data:dataItem, icon:"video_icon", img:imageItem});

}


The list instance name is videoList. The icon for list items is a
movie clip called "video_icon".

The solution must be to load the external images for each icon into the
"video_icon" symbol using loadMovie. I'm just not sure how to do that - I've tried several approaches including using a placeholder image inside of the "video_icon" to load the external thumbnail image specified in the xml file. I can't get this to work. Thanks in advance for any ideas/suggestions.