Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loadMovie not retaining Action Script?

Status
Not open for further replies.

Schteve

Programmer
Mar 29, 2005
14
0
0
US
Greetings.

My movie worked fine when I imported images to use as buttons. Later, however, I decided I'd swap some of the images as the movie is being played via the loadMovie function. Here's my main function ("p", "numb", and "i" are global variables):

_global.update = function() {
loadVarsText = new LoadVars();
loadVarsText.load("news.txt");
loadVarsText.onLoad = function(success) {
if (success) {
numb = this.num;
p = numb-i+1;
set("se"+0, eval("this.s"+p));
set("da"+0, eval("this.d"+p));
set("bo"+0, eval("this.b"+p));
showtext(0);
set("name", eval("this.s"+p));
loadMovie("head_"+name+".jpg", "head")
loadMovie("previous.jpg", "pre.previous")
loadMovie("next_dim.jpg", "nex.next")
}
}
}


When you click the "previous.jpg" and "next_dim,jpg" images, it is supposed to go through some simple code and update function to load different variables from my text file...but it doesn't. It just displays what was originally imported and doesn't rather than changing it.


Code for the "previous.jpg" image:
on (press) {
if (i<numb) {
i++;
update();
}
}

Code for the "next_dim.jpg" image:
on (press) {
if (i>1) {
i--;
update();
}
}


Thanks.
 
Nevermind, I used the trace function and soon discovered an error with a global variable. It works perfectly now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top