Código :
var easingvelo:Number = new Number (3);
var limit:Number = new Number (200);
var max:Number = new Number (8);
var margin:Number = new Number (15);
var zone:Number = new Number (200);
var yline:Number = new Number (130);
var yalign:String = new String ("down");
var textos:Array = new Array ("Honda Super Sport. Pintura metalitzada color plata, ABS, direcció asistida, ESP, fars de xenó.");
var num:Number = new Number ();
function recieve () {
//on Loaded
create (22);
}
function create (nm) {
num = nm;
createEmptyMovieClip ("clips", getNextHighestDepth ());
var props:Object = new Object ();
props._x = 0;
if (yalign == "down") {
props._y = yline - 45.2;
} else if (yalign == "up") {
props._y = yline;
} else {
props._y = yline - (45.2 / 2);
}
for (i = 0; i < num; i++) {
clips.attachMovie ("clip", "clip" + i, clips.getNextHighestDepth (), props);
props._x += 70;
}
desc.swapDepths (getNextHighestDepth ());
loadClips ();
}
function loadClips () {
for (i = 0; i < _root.num; i++) {
with (_root.clips["clip" + i]) {
var loader:MovieClipLoader = new MovieClipLoader ();
var listener:Object = new Object ();
listener.onLoadInit = function (target:MovieClip) {
_root.mirror (target);
num = Number (_name.charAt (4) + _name.charAt (5));
target._width /= 2.5;
target._height /= 2.5;
target._parent.onEnterFrame = function () {
if (num > 0) {
if (_root.clips["clip" + (num - 1)]._alpha == 100) {
this._alpha += 20;
}
} else {
this._alpha += 20;
}
if (this._alpha > 100) {
this._alpha = 100;
if (num == _root.num - 1) {
_root.motion ();
}
delete this.onEnterFrame;
}
};
};
listener.onLoadError = function (target:MovieClip) {
num = Number (_name.charAt (4) + _name.charAt (5));
trace ("Load error on image " + num);
//carrega informacio i agafa imatge genèrica
target._parent.attachMovie ("loadError", "loadError", target.getNextHighestDepth ());
target._parent.loadError._width /= 2.5;
target._parent.loadError._height /= 2.5;
target._parent.onEnterFrame = function () {
if (num > 0) {
if (_root.clips["clip" + (num - 1)]._alpha == 100) {
this._alpha += 20;
}
} else {
this._alpha += 20;
}
if (this._alpha > 100) {
this._alpha = 100;
if (num == _root.num - 1) {
_root.motion ();
}
delete this.onEnterFrame;
}
};
};
loader.addListener (listener);
loader.loadClip ("fotos/foto" + i + ".jpg", container);
}
}
}
function mirror (target) {
target.duplicateMovieClip ("dupli", 1000);
with (target._parent.dupli) {
_alpha = 50;
_yscale = -100;
_y += _height * 2;
}
}
function motion () {
var dif:Number = new Number ();
var velo:Number = new Number ();
var obj:Number = new Number ();
_root.onEnterFrame = function () {
scale ();
velo = (_xmouse < 502) ? dif / 502 * max : -(dif / 502 * max);
dif = Math.abs (502 - _xmouse);
if (dif < zone) {
velo = 0;
}
obj += velo;
if (obj > 0) {
obj = 0;
} else if (obj < -(clips._width - Stage.width)) {
obj = -(clips._width - Stage.width);
}
if (clips._width > Stage.width) {
clips._x += (obj - clips._x) / easingvelo;
} else {
clips._x += ((Stage.width / 2 - clips._width / 2) - clips._x) / easingvelo;
}
};
}
function scale () {
for (i = 0; i < num; i++) {
with (clips["clip" + i]) {
distancia = Math.abs (_x + _width / 2 - _parent._xmouse);
if (distancia < _root.limit) {
xobj = 100 + ((_root.limit - distancia) * 150 / _root.limit);
} else {
xobj = 100;
}
_xscale = _yscale += (xobj - _xscale) / _root.easingvelo;
if (_root.yalign == "down") {
clips["clip" + i]._y = yline - clips["clip" + i]._height;
} else if (_root.yalign == "up") {
clips["clip" + i]._y = yline;
} else {
clips["clip" + i]._y = yline - clips["clip" + i]._height / 2;
}
}
}
adjust ();
}
function adjust () {
for (i = 1; i < num; i++) {
clips["clip" + i].obj = clips["clip" + (i - 1)]._x + clips["clip" + (i - 1)]._width + margin;
with (clips["clip" + i]) {
_x += (obj - _x) / _root.easingvelo;
}
}
description ();
}
function description () {
for (i = 0; i < num; i++) {
if (clips["clip" + i].hitTest (clips._xmouse, clips._ymouse, true)) {
desc.tex = textos[i];
}
}
}
recieve ();
El problema es que no se produce el duplicateMovieClip, no me copia el clip...
Alguién me puede ayudar?
