Skip to main content
Inspiring
May 29, 2006
Question

LoadVars' sendAndLoad is altering buttons behaviour

  • May 29, 2006
  • 3 replies
  • 250 views
hi, i'm having a weird problem with a rather simple movie:

1. it loads images from the server using the loadMovie method from
different folders
2. the folder can be choosen from a combo box component
3. LoadVars sendAndLoad method send the folder name to a PHP script wich
returns images names in that folder as a string

the problem is that when you change the folder, i.e., a second
sendAndLoad method is issued, buttons to navigate to previous/next image
begin to behave odd: you need to move the cursor over them before
clicking or the actions aren't executed!?

you can take a look here. note that initially the buttons work fine, the
problem appears when you change the folder

http://www.master.esdi.es/interactius06/msocarras/2006/exercises/pint/load_img_web_2.htm

here is the code (1 frame movie);

var imagesArr:Array = new Array();

var lv:LoadVars = new LoadVars();
lv.dir = cbDir.selectedItem.label;

lv.sendAndLoad("read_folder_2.php", lv, "POST");

lv.onLoad = function(success) {
if (success) {
stringToArray(this.str);
} else {
counter.text = "Error:"+this.str;
}
}

var cbListener bject = new Object();
cbListener.change = function(eventObject bject) {
lv.dir = _root.cbDir.selectedItem.label;
lv.sendAndLoad("read_folder_2.php", lv, "POST");
};
cbDir.addEventListener("change", cbListener)

function stringToArray(str) {
imagesArr = str.split("|");
initialize();
}

function initialize() {
total = imagesArr.length;
i = 0;
loadImg(0);
}

previous.onRelease = function() {
if (i > 0) {
loadImg(-1);
}
}

next.onRelease = function() {
if (i < total-1) {
loadImg(1);
}
}

function loadImg(incr) {
i = i + incr;
container.loadMovie(lv.dir+"/"+imagesArr );
counter.text = i+1+"/"+total;
}

This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
May 29, 2006
yes, every time i start to use a component i end up making my own movieclip that performs the same function and is easier to control/customize.
Inspiring
May 29, 2006
thanks kglad. Flash components works fine alone but are a huge source of
nasty side effects )-:

kglad wrote:
> that's a component issue. i don't know if there is a work-around, other than removing the problem component(s).
kglad
Community Expert
Community Expert
May 29, 2006
that's a component issue. i don't know if there is a work-around, other than removing the problem component(s).