Dyce
10-04-2007, 12:48 AM
I downloaded this tutorial but I can't get it to work.
Here's what it looks like so far:
http://www.neworleansblack.com/tv_test.html
I'm pretty sure I followed the directions to the tee. It is supposed to load a media list from an external xml file, autoPlay the first item in the list and play the rest sequentially. For some reason it's only loading the first video and not automatically. I'm thinking it's either an actionscript issue or a xml issue. I'm posting both in hopes that one of the geniuses here will have some insight on this.
Actionscript:
//Default gradient fill
var gradientDefault:Object = new Object;
gradientDefault.fillType = "linear";
gradientDefault.colors = [0x000000, 0x333333];
gradientDefault.alphas = [75, 75];
gradientDefault.ratios = [0, 255];
gradientDefault.matrix = new flash.geom.Matrix();
gradientDefault.matrix.createGradientBox(100, 50, (Math.PI * 3 / 2), 0, 0);
myList.itemDefaultStyle.fillGradient = gradientDefault;
//Over gradient fill
var gradientOver:Object = new Object;
gradientOver.fillType = "linear";
gradientOver.colors = [0x000000, 0x333333];
gradientOver.alphas = [85, 85];
gradientOver.ratios = [0, 255];
gradientOver.matrix = new flash.geom.Matrix();
gradientOver.matrix.createGradientBox(100, 50, (Math.PI * 3 / 2), 0, 0);
myList.itemOverStyle.fillGradient = gradientOver;
//Selected gradient fill
var gradientSelected:Object = new Object;
gradientSelected.fillType = "linear";
gradientSelected.colors = [0x000000, 0x333333];
gradientSelected.alphas = [95, 95];
gradientSelected.ratios = [0, 255];
gradientSelected.matrix = new flash.geom.Matrix();
gradientSelected.matrix.createGradientBox(100, 50, (Math.PI * 3 / 2), 0, 0);
myList.itemSelectedStyle.fillGradient = gradientSelected;
//Play the first item when loading is complete
myList.addEventListener("CONTENT_LOAD_COMPLETE", this);
function CONTENT_LOAD_COMPLETE(evnt:Object) {
//Select first item in the list
myList.selectItemNum(0);
//Get and play the first item in the list
var item:Object = myList.getItemNum(0);
myPlayer.autoSize = false;
myPlayer.contentPath = item.data;
}
//Select next item when play completes
var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
myList.selectNextItem();
//Get and play the next item
var item = myList.getSelectedItem();
myPlayer.autoSize = false;
myPlayer.contentPath = item.data;
};
myPlayer.addEventListener("complete", listenerObject);
//Play an item when it is clicked.
myList.addEventListener("ITEM_ON_RELEASE", this);
function ITEM_ON_RELEASE(evnt:Object) {
myPlayer.autoSize = false;
myPlayer.contentPath = evnt.target.data;
}
XML:
<?xml version="1.0"?>
<content>
<item>
<title>Mychal Bell Relased from Prison</title>
<description></description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/MychalBellReleased.flv</data>
</item>
<item>
<title>Single Black Female</title>
<description></description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/SingleAfricanAmericanWomen.flv</data>
</item>
<item>
<title>Soulja Boy How To</title>
<description>Learn how the newest dance sweeping the country.</description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/SouljaBoy_instructionalvideo.flv</data>
</item>
<item>
<title>Health in New Orleans</title>
<description></description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/NewOrleansHealth.flv</data>
</item>
</content>
I can also upload the .fla file if needed.
Here's what it looks like so far:
http://www.neworleansblack.com/tv_test.html
I'm pretty sure I followed the directions to the tee. It is supposed to load a media list from an external xml file, autoPlay the first item in the list and play the rest sequentially. For some reason it's only loading the first video and not automatically. I'm thinking it's either an actionscript issue or a xml issue. I'm posting both in hopes that one of the geniuses here will have some insight on this.
Actionscript:
//Default gradient fill
var gradientDefault:Object = new Object;
gradientDefault.fillType = "linear";
gradientDefault.colors = [0x000000, 0x333333];
gradientDefault.alphas = [75, 75];
gradientDefault.ratios = [0, 255];
gradientDefault.matrix = new flash.geom.Matrix();
gradientDefault.matrix.createGradientBox(100, 50, (Math.PI * 3 / 2), 0, 0);
myList.itemDefaultStyle.fillGradient = gradientDefault;
//Over gradient fill
var gradientOver:Object = new Object;
gradientOver.fillType = "linear";
gradientOver.colors = [0x000000, 0x333333];
gradientOver.alphas = [85, 85];
gradientOver.ratios = [0, 255];
gradientOver.matrix = new flash.geom.Matrix();
gradientOver.matrix.createGradientBox(100, 50, (Math.PI * 3 / 2), 0, 0);
myList.itemOverStyle.fillGradient = gradientOver;
//Selected gradient fill
var gradientSelected:Object = new Object;
gradientSelected.fillType = "linear";
gradientSelected.colors = [0x000000, 0x333333];
gradientSelected.alphas = [95, 95];
gradientSelected.ratios = [0, 255];
gradientSelected.matrix = new flash.geom.Matrix();
gradientSelected.matrix.createGradientBox(100, 50, (Math.PI * 3 / 2), 0, 0);
myList.itemSelectedStyle.fillGradient = gradientSelected;
//Play the first item when loading is complete
myList.addEventListener("CONTENT_LOAD_COMPLETE", this);
function CONTENT_LOAD_COMPLETE(evnt:Object) {
//Select first item in the list
myList.selectItemNum(0);
//Get and play the first item in the list
var item:Object = myList.getItemNum(0);
myPlayer.autoSize = false;
myPlayer.contentPath = item.data;
}
//Select next item when play completes
var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
myList.selectNextItem();
//Get and play the next item
var item = myList.getSelectedItem();
myPlayer.autoSize = false;
myPlayer.contentPath = item.data;
};
myPlayer.addEventListener("complete", listenerObject);
//Play an item when it is clicked.
myList.addEventListener("ITEM_ON_RELEASE", this);
function ITEM_ON_RELEASE(evnt:Object) {
myPlayer.autoSize = false;
myPlayer.contentPath = evnt.target.data;
}
XML:
<?xml version="1.0"?>
<content>
<item>
<title>Mychal Bell Relased from Prison</title>
<description></description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/MychalBellReleased.flv</data>
</item>
<item>
<title>Single Black Female</title>
<description></description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/SingleAfricanAmericanWomen.flv</data>
</item>
<item>
<title>Soulja Boy How To</title>
<description>Learn how the newest dance sweeping the country.</description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/SouljaBoy_instructionalvideo.flv</data>
</item>
<item>
<title>Health in New Orleans</title>
<description></description>
<thumbnailPath></thumbnailPath>
<data>http://www.neworleansblack.com/nobtv/NewOrleansHealth.flv</data>
</item>
</content>
I can also upload the .fla file if needed.