Hello everyone :)
please excuse my bad english. i hope some help from you please :)

when i use :

for (var i = 0; i < nb_file_xml; i++) {
                var fichier = "Profil" + (i+1) + ".xml";
                tl.loadXML(fichier, function(xml, url) { Profil[i].loadXML(xml,
url); });
        }

i have  an alert box with  : Caught exception : Type Error : Profil[i]
is undefined

when i use :
 tl.loadXML("Profil1.xml", function(xml, url) { Profil[0].loadXML(xml,
url); });
 tl.loadXML("Profil2.xml", function(xml, url) { Profil[1].loadXML(xml,
url); });

it works fine.

here is the complete code :

<html>
<head>
  <title>SIMILE | Timeline | Profils</title>
  <script src="http://simile.mit.edu/timeline/api/timeline-api.js";
type="text/javascript"></script>
  <script src="fonctions.js" type="text/javascript"></script>
  <script>
    var tl;
    function onLoad() {
        var url = window.location.href;
        var Profil =  new Array();
        var bandInfos =  new Array();
        var nb_file_xml = 2;
        var taille = 100/nb_file_xml;
        var d = "1758"

            var theme = Timeline.ClassicTheme.create();
            theme.event.bubble.width = 320;
            theme.event.bubble.height = 220;
            theme.event.track.height = 1.5;
            theme.event.track.gap = 0.1;
            theme.ether.backgroundColors = [
                "#D1CECA",
                "#E7DFD6",
                "#E8E8F4",
                "#D0D0E8"
            ];

        for (var i = 0; i < nb_file_xml; i++) {

                Profil[i] = new Timeline.DefaultEventSource();
                bandInfos[i] = Timeline.createBandInfo({
                        width:          taille + "%",
                        intervalUnit:   Timeline.DateTime.YEAR,
                        intervalPixels: 100,
                        eventSource:    Profil[i],
                        date:           d,
                        timeZone:       0,
                        theme:          theme
                });
        }

        for (var i = 0; i < nb_file_xml-1; i++) {
                bandInfos[i].syncWith = i+1;
        }

        tl = Timeline.create(document.getElementById("tl"), bandInfos,
Timeline.HORIZONTAL);

            //tl.loadXML("Profil1.xml", function(xml, url)
{ Profil[0].loadXML(xml, url); });
           // tl.loadXML("Profil2.xml", function(xml, url)
{ Profil[1].loadXML(xml, url); });

        for (var i = 0; i < nb_file_xml; i++) {
                var fichier = "Profil" + (i+1) + ".xml";
                tl.loadXML(fichier, function(xml, url) { Profil[i].loadXML(xml,
url); });
        }
    }

        var resizeTimerID = null;
        function onResize() {
            if (resizeTimerID == null) {
                resizeTimerID = window.setTimeout(function() {
                    resizeTimerID = null;
                    tl.layout();
                }, 500);
            }
        }
    </script>
</head>
<body onload="onLoad();" onresize="onResize();">

<div id="body">
    <h1>Profils Timeline</h1>
    <div id="tl" style="height: 80%">
    </div>

</div>
</body>
</html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to