Charger des liens avec un fichier XML
Bonjour,
Voici des jours que je cherche le moyen de faire charger par flash des descriptif, liens, et nom d'image via un fichier XML et en ligne ...
En effet, tout fonctionne correctement en local !!!!
C'est ça que je pige pas ...
Je débute en AS et flash donc, voici les codes AS
Votre aide me sera très précieuse car le job devrait être fini demain ...:?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
filename_list = new Array();
url_list = new Array();
title_list = new Array();
description_list = new Array();
var filepath = "thumbnails/";
var flashmo_xml = new XML();
flashmo_xml.ignoreWhite = true;
flashmo_xml.onLoad = function()
{
var nodes:Array = this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
filename_list.push(nodes[i].attributes.filename);
url_list.push(nodes[i].attributes.url);
title_list.push(nodes[i].attributes.title);
description_list.push(nodes[i].attributes.description);
}
}
flashmo_xml.load("movie_list.xml");
tn_group_area._visible = false; |
ensuite
Code:
1 2 3 4 5 6 7
|
this.onEnterFrame = function()
{
if( flashmo_xml.loaded )
play();
else
gotoAndStop(31); |
Puis
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| tn_group.tn._visible = false;
tn_group_area._visible = true;
tn_group.setMask( tn_group_area );
import mx.transitions.Tween;
import mx.transitions.easing.*;
var fm_show_no:Number = 3; // number of thumbnails showing at a time
var total:Number = filename_list.length;
var distance_x:Number = tn_group.tn._width + 5;
var i:Number = 0;
var start_from:Number = 0;
var current:Number = 0;
fm_title.text = "";
fm_description.text = "";
for( ; i < total; i++ )
{
tn_group.tn.duplicateMovieClip("tn"+i, i);
tn_group["tn"+i].preloader._width = 0;
tn_group["tn"+i].tn_button._visible = false;
tn_group["tn"+i].txt = (i+1);
tn_group["tn"+i].tn_no = i;
tn_group["tn"+i]._x = i * distance_x;
tn_group["tn"+i].tn_button.onRollOver = function()
{
this._parent._parent._parent.fm_title.text = title_list[this._parent.tn_no];
this._parent._parent._parent.fm_description.text = description_list[this._parent.tn_no];
}
tn_group["tn"+i].tn_button.onRollOut = function()
{
this._parent._parent._parent.fm_title.text = "";
this._parent._parent._parent.fm_description.text = "";
}
tn_group["tn"+i].tn_button.onRelease = function()
{
getURL(url_list[this._parent.tn_no], "_blank");
}
}
function move_it()
{
if( total - start_from < fm_show_no )
start_from = total - fm_show_no;
if( start_from < fm_show_no )
start_from = 0;
position_x = start_from * distance_x - tn_group_area._x;
new Tween(tn_group, "_x", Bounce.easeOut, tn_group._x, -position_x, 1.2, true);
}
fm_previous.onRelease = function()
{
start_from -= fm_show_no;
move_it();
}
fm_next.onRelease = function()
{
start_from += fm_show_no;
move_it();
} |
Aussi
Code:
1 2 3 4 5 6
|
stop();
tn_group["tn"+current].tn_pic.loadMovie( filepath + filename_list[current] );
tn_group["tn"+current].tn_pic2.loadMovie( filepath + filename_list[current] );
tn_group["tn"+current].tn_pic._alpha = 0;
onEnterFrame = function() |
Après ce code j'ai toute les variables pour afficher les preloader , txt etc ...
Mais bizare , je ne sais pas faire de copié collé ???
Au fait, il semble y avoir une erreur ici : onEnterFrame = function()
['{'attendu] mais le { se trouve juste la ligne après il englobe le tout et est bien terminé par }
Il y a encore :
Code:
1 2 3 4 5 6 7 8 9 10
|
if( current < total - 1 )
{
current++;
prevFrame();
}
else
{
nextFrame();
} |
En espèrant de l'aide parce que là ....:roll:
Merci,