Load text

I want to load dynamically two text at the same time
on the same frame. For that I wrotte :

loadText = new loadVars();
loadText.load(“textes/news_comp.txt”);
loadText.onLoad = function() {
newsscroller.html = true;
newsscroller.htmlText = this.content;
};
loadText2 = new loadVars();
loadText2.load(“textes/event.txt”);
loadText2.onLoad = function() {
eventscroller.html = true;
eventscroller.htmlText = this.event;
};

For some reason, offline every thing works fine but online only one text is loaded??
Somebody now’s why?

Corinne

Did you try to change the order of the onLoad calls?

yes. The same problem.

try adding the second load to the onload function of the first. I don’t know if Flash MX has separate threads of execution for each request you make. If it doesn’t, the first request keeps the single thread busy while your timeline thread simply zips right through the second request. Although it may be assumed that the second request simply is queued until the first is completed, this may not be the case–I don’t know! It all depends on how the Flash player is designed to handle the synching/queuing of threads. But I’ll bet if you instantiate the second request in the onload event handling method of the first, you’ll get the desired results. I’d bet something like this may work:

loadText = new loadVars();
loadText.load(“textes/news_comp.txt”);
loadText.onLoad = firstLoaded;
}

function firstLoaded() {
newsscroller.html = true;
newsscroller.htmlText = this.content;
loadText2 = new loadVars();
loadText2.load(“textes/event.txt”);
loadText2.onLoad = secondLoaded;
}

function secondLoaded(){
eventscroller.html = true;
eventscroller.htmlText = this.event;
}

Hope that helps! I’m not lucky enough to have a Flash-related job (yet), so this is from memory/experience/theory–can’t test it out. Let me know if it works for you!
-Brock

I actually got it working this way:

loadText = new loadVars();
loadText.load("content.txt");
loadText.load("event.txt");
loadText.onLoad = function() {
	newsscroller.html = true;
	eventscroller.html = true;	
    newsscroller.htmlText = this.content;
    eventscroller.htmlText = this.event;
};

its working.

http://www.kemppro.com

Question: when you put on top “php:”,
am I suppose do create php file ?

Thank’s for all your helps

Corinne

Nice menu! :stuck_out_tongue:

And no, you don’t have to create a PHP file, it’s just AS.

[SIZE=1]By the way, nice trick, h88. I’m rating this[/SIZE] :slight_smile:

Oh yeah, thanx for rating that ilyas, i rated it as well. :wink: