flash data integration:
I've been working on a flash video player in which icons float in a circular
motion around a large video window. When you click on one of the floating
icons, I want that video to play in the large window. The whole thing reads
from an xml file to get the images inside the icons as well as what videos to
play:
<icons>
<icon image="icon1.jpg" url="promo1.flv" />
<icon image="icon2.jpg" url="promo2.flv" />
AND SO ON.....
</icons>
The following is the part of my actionscript that is giving me the problem.
Everything loads fine and looks great. But, when you get down to the part where
it says ns.play("http://......, in the testing phase it gives me "Error opening
URL "
http://www.ktul.com/static/videos/undefined"". I'm sure it's because it's
inside a function. But, I don't know what I can do to make it work. You can
view this thing in action at
http://www.ktul.com/static/newcarousel.swf. Any
ideas?
MY ACTIONSCRIPT:
var numOfItems:Number;
var radiusX:Number = Stage.width/2;
var radiusY:Number = Stage.height/3;
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;
var speed:Number = 0.05;
var perspective:Number = 130;
var home:MovieClip = this;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for (var i=0;i<numOfItems;i++)
{
var t = home.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
t.icon_mc.loadMovie("
http://www.ktul.com/static/"+nodes[i].attributes.image);
t.onPress = function()
{
ns.play("
http://www.ktul.com/static/videos/"+attributes.url);
}
}
}
xml.load("
http://www.ktul.com/static/icons.xml");
function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s:Number = this._y / (centerY+radiusY);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 110);
}
this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/5500;
}
Thanks for any help.
Kevin