Dr_Bra
20.12.2008, 21:45
Не получается подгружать внешние swf файлы с помощью XML. В клипе есть 25 иконок, при нажатии на каждую из которых должен загружаться соответствующий ей swf файл. Почему-то при нажатии на иконки в окне Output появляется ругань на ошибку загрузки Undefined файла, хотя трассировка списка адресов внешних файлов показывает, что из XML они грузятся нормально...
ссылка на архив с исходником лежит здесь:
http://***********/9657246
var radiusX:Number =400;
var radiusY:Number = 70;
var centerX:Number = 500;
var centerY:Number =400;
var speed:Number = 0.02;
var perspective:Number = 1;
var home:MovieClip = this;
var tooltip:MovieClip = this.attachMovie("tooltip", "tooltip", 10000);
tooltip._alpha = 0;
moviepath._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for ( 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.toolText = nodes[i].attributes.tooltip;
t.path = nodes[i].attributes.portfolioitems;
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.ref.inner.loadMovie(nodes[i].attributes.image);
t.icon.onRollOver = over;
t.icon.onRollOut = out;
t.icon.onPress = presss;
path2 = t.path;
trace(nodes[i].attributes.image)
trace(t.path);
}
}
function over()
{
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}
function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}
function presss()
{
_root.attachMovie("moviepath","moviepath",10000000);
}
function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
}
xml.load("icons.xml");
function mover() {
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = (this._y - perspective) / (centerY+radiusY - perspective);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale)+100);
}
this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/10000;
}
ссылка на архив с исходником лежит здесь:
http://***********/9657246
var radiusX:Number =400;
var radiusY:Number = 70;
var centerX:Number = 500;
var centerY:Number =400;
var speed:Number = 0.02;
var perspective:Number = 1;
var home:MovieClip = this;
var tooltip:MovieClip = this.attachMovie("tooltip", "tooltip", 10000);
tooltip._alpha = 0;
moviepath._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for ( 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.toolText = nodes[i].attributes.tooltip;
t.path = nodes[i].attributes.portfolioitems;
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.ref.inner.loadMovie(nodes[i].attributes.image);
t.icon.onRollOver = over;
t.icon.onRollOut = out;
t.icon.onPress = presss;
path2 = t.path;
trace(nodes[i].attributes.image)
trace(t.path);
}
}
function over()
{
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
home.tooltip._alpha = 100;
}
function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}
function presss()
{
_root.attachMovie("moviepath","moviepath",10000000);
}
function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height/2;
}
xml.load("icons.xml");
function mover() {
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = (this._y - perspective) / (centerY+radiusY - perspective);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale)+100);
}
this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/10000;
}