Ciao... ho trovato un'interessante script girando in rete.....
e' un banner che carica immagini e testo da un file xml....ha uno slide automatico ed anche un simpatico effetto elastico...
il mio problema e' che le immagini e il testo le carica randon ...pur avendoci anche i tasti next e prev....non segue un ordine.....
ora io ho il codice che ho provato anche a studiare ma non capisco proprio qual 'e' il parametro che va settato.....
qualcuno di buon cuore puo' darmi una dritta?????????????
grazieeeeeeeeeeeee
import mx.transitions.Tween;
import mx.transitions.easing.*;
image_list = new Array();
heading_list = new Array();
price_list = new Array();
trial_list = new Array();
buy_list = new Array();
var fIndex:Number;
var slide_noX:Number = 608;
url_list = new Array();
desc_list = new Array();
var pic_xml = new XML();
pic_xml.load("banner.xml");
pic_xml.ignoreWhite = true;
pic_xml.onLoad = function() {
var nodes:Array = this.firstChild.childNodes;
for (var i = 0; i<nodes.length; i++) {
image_list.push(nodes[i].attributes.image);
heading_list.push(nodes[i].attributes.heading);
price_list.push(nodes[i].attributes.price);
trial_list.push(nodes[i].attributes.trialurl);
buy_list.push(nodes[i].attributes.buynowurl);
desc_list.push(nodes[i].childNodes[0].nodeValue);
tn_group["tn"+0].link_group.links.htmlText = nodes[0].childNodes[1].nodeValue;
tn_group["tn"+0].link_group2.links_txt.htmlText = nodes[0].childNodes[2].nodeValue;
tn_group["tn"+0].launch_mc.launch.text = launch_list[0];
tn_group["tn"+0].launch_mc.launch_btn.onRelease = function() {
getURL(launchurl_list[0]);
};
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = txtcolor_list[i];
tn_group.tn.duplicateMovieClip("tn"+i,i);
_root.attachMovie("slide_no","slide_no"+i,i);
_root["slide_no"+i]._x = slide_noX;
slide_noX = slide_noX+10;
_root["slide_no"+i]._y = 130;
_root["slide_no"+i].nu.no.text = i+1;
prev_btn._x = _root["slide_no"+0]._x-60;
prev_btn._y = _root["slide_no"+0]._y;
next_btn._x = (_root["slide_no"+0]._x)+_root["slide_no"+0]._width*nodes.length;
next_btn._y = _root["slide_no"+0]._y;
move_slide.swapDepths(i);
move_slide.onRollOver = function() {
move_slide.useHandCursor = false;
};
move_slide._x = _root["slide_no"+0]._x;
move_slide._x = _root["slide_no"+0]._x;
move_slide._y = _root["slide_no"+0]._y;
tn_group["tn"+0].trial_btn.onRelease = function() {
getURL(trial_list[(this._parent._parent._parent.move_slide.nu.no.tex t)-1]);
};
tn_group["tn"+0].buy_btn.onRelease = function() {
getURL(buy_list[(this._parent._parent._parent.move_slide.nu.no.tex t)-1]);
};
tn_group["tn"+0].contents.htmlText = nodes[0].childNodes[0].nodeValue;
tn_group["tn"+0].heading.text = heading_list[0];
tn_group["tn"+0].heading.setTextFormat(my_fmt);
tn_group["tn"+0].price.text = price_list[0];
move_slide.nu.no.text = 1;
next_btn.btn.onRollOver = function() {
clearInterval(intNum);
};
next_btn.btn.onRollOut = function() {
intNum = setInterval(automove, 10000);
};
prev_btn.btn.onRelease = function() {
clearInterval(intNum);
pFrame();
};
prev_btn.btn.onRollOver = function() {
clearInterval(intNum);
};
prev_btn.btn.onRollOut = function() {
intNum = setInterval(automove, 10000);
};
_root["slide_no"+i].slide_btn.onRollOver = function() {
clearInterval(intNum);
};
_root["slide_no"+i].slide_btn.onRollOut = function() {
intNum = setInterval(automove, 10000);
};
_root["slide_no"+i].slide_btn.onRelease = function() {
clearInterval(intNum);
var xpos:Number = this._parent._x;
fIndex = parseInt(getProperty(this._parent, _name).substring(8, sName));
if (dummy._alpha == 100) {
if (dummy2._alpha == 0) {
tn_group["tn"+0].link_group._visible = true;
tn_group["tn"+0].link_group2._visible = true;
tn_group["tn"+0].launch_mc._visible = true;
}
var aniM:Tween = new Tween(move_slide, "_x", Elastic.easeOut, _root.move_slide._x, xpos, .5, 1, true);
move_slide.nu.no.text = fIndex+1;
if (fIndex>0) {
tn_group["tn"+0].link_group._visible = false;
tn_group["tn"+0].link_group2._visible = false;
tn_group["tn"+0].launch_mc._visible = false;
}
tn_group["tn"+0].contents.htmlText = nodes[getProperty(this._parent, _name).substring(8, sName)].childNodes[0].nodeValue;
tn_group["tn"+0].heading.text = heading_list[getProperty(this._parent, _name).substring(8, sName)];
tn_group["tn"+0].price.text = price_list[getProperty(this._parent, _name).substring(8, sName)];
tn_group["tn"+0].tn_pic.loadMovie(image_list[getProperty(this._parent, _name).substring(8, sName)]);
tn_group["tn"+0].tn_pic._alpha = 0;
preload();
tn_group["tn"+0].contents._y = 200;
tn_group["tn"+0].heading._y = 200;
tn_group["tn"+0].price._y = 200;
tn_group["tn"+0].buy_btn._y = 200;
tn_group["tn"+0].trial_btn._y = 200;
tn_group["tn"+0].link_group._y = 200;
tn_group["tn"+0].link_group2._y = 200;
tn_group["tn"+0].launch_mc._y = 200;
}
};
}
tn_group["tn"+0].tn_pic.loadMovie(image_list[0]);
tn_group["tn"+0].tn_pic._alpha = 0;
preload();
};
intNum = setInterval(automove, 10000);
next_btn.btn.onRelease = function() {
clearInterval(intNum);
nFrame();
};
fIndex = 0;
function preload() {
onEnterFrame = function () {
total_loaded = tn_group["tn"+0].tn_pic.getBytesTotal();
percent = Math.round(tn_group["tn"+0].tn_pic.getBytesLoaded()/total_loaded*100);
if (percent == 100) {
tn_group["tn"+0].tn_pic._alpha += 5;
tn_group["tn"+0].contents._x = tn_group["tn"+0].tn_pic._x+tn_group["tn"+0].tn_pic._width+20;
tn_group["tn"+0].heading._x = tn_group["tn"+0].tn_pic._x+tn_group["tn"+0].tn_pic._width+20;
tn_group["tn"+0].link_group._x = tn_group["tn"+0].tn_pic._x+tn_group["tn"+0].tn_pic._width+20;
tn_group["tn"+0].link_group2._x = tn_group["tn"+0].tn_pic._x+tn_group["tn"+0].tn_pic._width+150;
}
if (tn_group["tn"+0].tn_pic._alpha>100) {
delete this.onEnterFrame;
anim();
}
};
}
function anim() {
var anm:Tween = new Tween(tn_group["tn"+0].contents, "_y", Elastic.easeOut, 200, 16.4, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].heading, "_y", Elastic.easeOut, 200, -10, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].price, "_y", Elastic.easeOut, 200, 70, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].trial_btn, "_y", Elastic.easeOut, 200, 20, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].buy_btn, "_y", Elastic.easeOut, 200, 45, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].link_group, "_y", Elastic.easeOut, 300, 70, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].link_group2, "_y", Elastic.easeOut, 200, 70, 2, 1, true);
var anm:Tween = new Tween(tn_group["tn"+0].launch_mc, "_y", Elastic.easeOut, 200, 70, 2, 1, true);
var anm:Tween = new Tween(dummy, "_alpha", Elastic.easeOut, 0, 100, 2, 1, true);
var anm:Tween = new Tween(dummy2, "_alpha", Elastic.easeOut, 100, 0, 3, 1, true);
}
function nFrame() {
if (fIndex == heading_list.length-1) {
fIndex = 0;
if (dummy._alpha == 100) {
if (dummy2._alpha == 0) {
tn_group["tn"+0].link_group._visible = true;
tn_group["tn"+0].link_group2._visible = true;
tn_group["tn"+0].launch_mc._visible = true;
}
if (fIndex>0) {
tn_group["tn"+0].link_group._visible = false;
tn_group["tn"+0].link_group2._visible = false;
tn_group["tn"+0].launch_mc._visible = false;
}
tn_group["tn"+0].contents.htmlText = desc_list[fIndex];
tn_group["tn"+0].heading.text = heading_list[fIndex];
tn_group["tn"+0].price.text = price_list[fIndex];
tn_group["tn"+0].tn_pic.loadMovie(image_list[fIndex]);
tn_group["tn"+0].tn_pic._alpha = 0;
preload();
tn_group["tn"+0].contents._y = 200;
tn_group["tn"+0].heading._y = 200;
tn_group["tn"+0].price._y = 200;
tn_group["tn"+0].buy_btn._y = 200;
tn_group["tn"+0].trial_btn._y = 200;
tn_group["tn"+0].link_group._y = 200;
tn_group["tn"+0].link_group2._y = 200;
tn_group["tn"+0].launch_mc._y = 200;
var aniM:Tween = new Tween(move_slide, "_x", Elastic.easeOut, _root.move_slide._x, _root["slide_no"+fIndex]._x, .5, 1, true);
move_slide.nu.no.text = fIndex+1;
}
} else {
fIndex++;
if (dummy._alpha == 100) {
if (dummy2._alpha == 0) {
tn_group["tn"+0].link_group._visible = true;
tn_group["tn"+0].link_group2._visible = true;
tn_group["tn"+0].launch_mc._visible = true;
}
if (fIndex>0) {
tn_group["tn"+0].link_group._visible = false;
tn_group["tn"+0].link_group2._visible = false;
tn_group["tn"+0].launch_mc._visible = false;
}
tn_group["tn"+0].contents.htmlText = desc_list[fIndex];
tn_group["tn"+0].heading.text = heading_list[fIndex];
tn_group["tn"+0].price.text = price_list[fIndex];
tn_group["tn"+0].tn_pic.loadMovie(image_list[fIndex]);
tn_group["tn"+0].tn_pic._alpha = 0;
preload();
tn_group["tn"+0].contents._y = 200;
tn_group["tn"+0].heading._y = 200;
tn_group["tn"+0].price._y = 200;
tn_group["tn"+0].buy_btn._y = 200;
tn_group["tn"+0].trial_btn._y = 200;
tn_group["tn"+0].link_group._y = 200;
tn_group["tn"+0].link_group2._y = 200;
tn_group["tn"+0].launch_mc._y = 200;
var aniM:Tween = new Tween(move_slide, "_x", Elastic.easeOut, _root.move_slide._x, _root["slide_no"+fIndex]._x, .5, 1, true);
move_slide.nu.no.text = fIndex+1;
}
}
}
function pFrame() {
if (fIndex == 0) {
fIndex = heading_list.length-1;
if (dummy._alpha == 100) {
if (dummy2._alpha == 0) {
tn_group["tn"+0].link_group._visible = true;
tn_group["tn"+0].link_group2._visible = true;
tn_group["tn"+0].launch_mc._visible = true;
}
if (fIndex>0) {
tn_group["tn"+0].link_group._visible = false;
tn_group["tn"+0].link_group2._visible = false;
tn_group["tn"+0].launch_mc._visible = false;
}
tn_group["tn"+0].contents.htmlText = desc_list[fIndex];
tn_group["tn"+0].heading.text = heading_list[fIndex];
tn_group["tn"+0].price.text = price_list[fIndex];
tn_group["tn"+0].tn_pic.loadMovie(image_list[fIndex]);
tn_group["tn"+0].tn_pic._alpha = 0;
preload();
tn_group["tn"+0].contents._y = 200;
tn_group["tn"+0].heading._y = 200;
tn_group["tn"+0].price._y = 200;
tn_group["tn"+0].buy_btn._y = 200;
tn_group["tn"+0].trial_btn._y = 200;
tn_group["tn"+0].link_group._y = 200;
tn_group["tn"+0].link_group2._y = 200;
tn_group["tn"+0].launch_mc._y = 200;
var aniM:Tween = new Tween(move_slide, "_x", Elastic.easeOut, _root.move_slide._x, _root["slide_no"+fIndex]._x, .5, 1, true);
move_slide.nu.no.text = fIndex+1;
}
} else {
fIndex--;
if (dummy._alpha == 100) {
if (dummy2._alpha == 0) {
tn_group["tn"+0].link_group._visible = true;
tn_group["tn"+0].link_group2._visible = true;
tn_group["tn"+0].launch_mc._visible = true;
}
if (fIndex>0) {
tn_group["tn"+0].link_group._visible = false;
tn_group["tn"+0].link_group2._visible = false;
tn_group["tn"+0].launch_mc._visible = false;
}
tn_group["tn"+0].contents.htmlText = desc_list[fIndex];
tn_group["tn"+0].heading.text = heading_list[fIndex];
tn_group["tn"+0].price.text = price_list[fIndex];
tn_group["tn"+0].tn_pic.loadMovie(image_list[fIndex]);
tn_group["tn"+0].tn_pic._alpha = 0;
preload();
tn_group["tn"+0].contents._y = 200;
tn_group["tn"+0].heading._y = 200;
tn_group["tn"+0].price._y = 200;
tn_group["tn"+0].buy_btn._y = 200;
tn_group["tn"+0].trial_btn._y = 200;
tn_group["tn"+0].link_group._y = 200;
tn_group["tn"+0].link_group2._y = 200;
tn_group["tn"+0].launch_mc._y = 200;
var aniM:Tween = new Tween(move_slide, "_x", Elastic.easeOut, _root.move_slide._x, _root["slide_no"+fIndex]._x, .5, 1, true);
move_slide.nu.no.text = fIndex+1;
}
}
}
var intNum:Number;

Rispondi quotando
