PDA

View Full Version : ComboBox on movie too slow


emilioestevezz
09-02-2004, 04:12 PM
Hi, im using flash mx Pro 2004 for making a user datainput form and iīve had one combobox for the user to choose one option, but this combobox when testing the movie it works but very slow , the rest of the form works ok, and sometimes when i try it on the webserver it displays a windows error that say: that a script on the animation is becoming the machine slowly, and that this might became the system unstable and if i want to stop the srcript.???

Any ideas why??

Thanks
Emilio.

deQue
09-02-2004, 06:39 PM
How about posting some code so we can see what's the problem?

emilioestevezz
09-02-2004, 06:45 PM
How about posting some code so we can see what's the problem?

sorry about that, it just that iīve posted it before but i forgot to repost it again:

Hereīs the script:

on (release) {
if (apellido =="") {
status = "Debe llenar el apellido del cliente!";
} else if (nombre =="") {
status = "Debe llenar el nombre del cliente!";
} else if (fecha =="") {
status = "Debe llenar la fecha de la entrevista!";
} else if (hora =="") {
status = "Debe llenar la hora de la entrevista!";
} else if (asunto =="") {
status = "Debe llenar el asunto del cliente!";
}else{
userData = new LoadVars();
userData.apellido = apellido;
userData.nombre = nombre;
userData.telefono = telefono;
userData.dni = dni;
userData.fecha = fecha;
userData.hora = hora;
userData.asunto = asunto;
userData.abogado = "";
userData.donde = "";

userData.abogado = abogado_cb.getValue();
userData.donde = donde_cb.getValue();

userData.send("inserta.php", "this", "POST");
getURL("inserta.php","this","POST");
status = "Datos Guardados!";
apellido = "";
nombre = "";
dni = "";
telefono = "";
fecha = "";
hora = "";
asunto = "";
}
}


Thanks.
Emilio

deQue
09-02-2004, 07:08 PM
Wel, I don't see what's wrong witht the code, but you do have two things you can improve in your code...
This is not needed, since you set them later. There's no need to pre-set them:
userData.abogado = "";
userData.donde = "";

Instead of using send, and getURL, use sendAndLoad:


userData.sendAndLoad("inserta.php", _root.insertaReply, "POST");


You'll have to add _root.insertaReply, which an object that will handle the data sent back from the server:
_root.insertaReply.onLoad = insertaReplyFUNC;
function insertaReplyFUNC(success) {
if (success) {
status = "Datos Guardados!";
} else {
status = "Server Error!";
}
}

emilioestevezz
09-02-2004, 07:20 PM
Wel, I don't see what's wrong witht the code, but you do have two things you can improve in your code...
This is not needed, since you set them later. There's no need to pre-set them:
userData.abogado = "";
userData.donde = "";

Instead of using send, and getURL, use sendAndLoad:


userData.sendAndLoad("inserta.php", _root.insertaReply, "POST");


You'll have to add _root.insertaReply, which an object that will handle the data sent back from the server:
_root.insertaReply.onLoad = insertaReplyFUNC;
function insertaReplyFUNC(success) {
if (success) {
status = "Datos Guardados!";
} else {
status = "Server Error!";
}
}



Well, ok ill try that , but ithink i should tell you a bit more of info about the movie at all, im new using flash so may be the hole thing is not accurate.

This is a flash form for inserting data that users type , to a mysql database on a local server. this Flash form have a few dynamic textboxīs for inserting the data and 2 combobox so users can select between options that want to use.

This script i showed you before, was inserted in the submit button , if itīs wrong please correct me.

If you need more info or anything tell me.

Thanks for helping its realy difficult for me to handle this.
Emilio.

deQue
09-02-2004, 07:30 PM
I understood perfectly what you are trying to do, and the corrections I suggested should solve your problems. I still don't understand what you meant about the ComboBox being slow...

emilioestevezz
09-02-2004, 07:35 PM
I understood perfectly what you are trying to do, and the corrections I suggested should solve your problems. I still don't understand what you meant about the ComboBox being slow...


I mean when i published the form on the webserver, and i test the form on a browser i insert all data ok when i try to select the combo options it take 6 to 15 seconds to display the options, is this normal? and sometime thereīs and warning message form windows that said that a script on the page is slowing donwn the sytem and give me the choise to abort the script or continue. If i hit continue it works ok, so nothing happens but i donīt know if this is ok.?

deQue
09-02-2004, 07:45 PM
What are you using to insert the data into your combo boxes?

emilioestevezz
09-02-2004, 08:01 PM
What are you using to insert the data into your combo boxes?

I just setted up data, labels as (Flash MX Pro 204):

labels: ["Select one:, option1,option2,option3"]
data: ["(no selection),option1,option2,option3"]
editable = false
rowcount = 50

Thats it

madgett
09-02-2004, 08:08 PM
It's taking so long because you are using LoadVars.send() then you are using getURL()...why not use LoadVars.sendAndLoad()?? Plus it depends on the visitors connection speed as well if you are loading variables from a server-side script.

emilioestevezz
09-02-2004, 09:14 PM
It's taking so long because you are using LoadVars.send() then you are using getURL()...why not use LoadVars.sendAndLoad()?? Plus it depends on the visitors connection speed as well if you are loading variables from a server-side script.

ok iīve used:

on (release) {
if (apellido =="") {
status = "Debe llenar el apellido del cliente!";
} else if (nombre =="") {
status = "Debe llenar el nombre del cliente!";
} else if (fecha =="") {
status = "Debe llenar la fecha de la entrevista!";
} else if (hora =="") {
status = "Debe llenar la hora de la entrevista!";
} else if (asunto =="") {
status = "Debe llenar el asunto del cliente!";
}else{
userData = new LoadVars();
userData.apellido = apellido;
userData.nombre = nombre;
userData.telefono = telefono;
userData.dni = dni;
userData.fecha = fecha;
userData.hora = hora;
userData.asunto = asunto;
userData.abogado = abogado_cb.getValue();
userData.donde = donde_cb.getValue();
userData.sendAndLoad("inserta.php", _root.insertaReply, "POST");
_root.insertaReply.onLoad = insertaReplyFUNC;
function insertaReplyFUNC(success) {
if (success) {
status = "Datos Guardados!";
} else {
status = "Error al guardar los datos!";
}
}
}
}

But it doesnīt works,

but the function insertReplyFUNC(success) , is this right to put it in here
??

Thanks

deQue
09-03-2004, 03:28 AM
Yes it is. If it doesn't work, Check where "status" is. Is it on the button, or inside another movie? Cause right now it's pointing to something inside the button.

Also, using 50 as rowCount is abit overkill! That's why it's slow, cause it has to draw 50 objects each time, and tween them all at once.

emilioestevezz
09-03-2004, 02:31 PM
Yes it is. If it doesn't work, Check where "status" is. Is it on the button, or inside another movie? Cause right now it's pointing to something inside the button.

Also, using 50 as rowCount is abit overkill! That's why it's slow, cause it has to draw 50 objects each time, and tween them all at once.

Ok, iīve changed the rowCount to 8 and it works ok!!! :)
One thing to go, make it work!!

"status" is a textbox setted to display dinamic text so when the button sends variables to php file then processed display the results.

But i donīt see any error there.

deQue
09-03-2004, 02:46 PM
Well, if the text box is not inside the button, it will not get the data you send it, cause it's on a deferent scope. You have to change status to _root.myMovie.status or wherever your status movie is.

emilioestevezz
09-03-2004, 02:53 PM
Well, if the text box is not inside the button, it will not get the data you send it, cause it's on a deferent scope. You have to change status to _root.myMovie.status or wherever your status movie is.

but in this part of the script status it is inside the button, isnīt it?

_root.insertaReply.onLoad = insertaReplyFUNC;
function insertaReplyFUNC(success) {
if (success) {
status = "Datos Guardados!";
} else {
status = "Error al guardar los datos!";
}
}

deQue
09-03-2004, 03:13 PM
Yes. The question is is the MOVIECLIP itself inside the button, not if the code says it is.

emilioestevezz
09-04-2004, 12:41 AM
Yes. The question is is the MOVIECLIP itself inside the button, not if the code says it is.

Do you mean if its exported for actionscript? Im sorry im quite new to flash, canīt you tell me how to do it?

Thanks very much.

deQue
09-04-2004, 01:03 AM
Is your movie INSIDE the button? Or next to it? When you double click on the button in the work area, it the status movieclip there, or not? If it's there than the code shoud work, if it's not, than find where it is, and that is where you have to point the "status =" line to.
For example: If your button is on the _root (on stage, not in ANY OTHER MOVIE), and it has the name of "myButton", then the path to it would be "_root.myButton". If the status movie is inside your button, than the path to it would ne "_root.myButton.status". BUT, if the status movie is next to the button (I.E. on STAGE), than the path to it would be "_root.status", and not "_root.myButton.status".

Now... if it is on the STAGE, then the line of code in your button action should be _root.status = "blah blah blah", if not, then whatever the path is to you status movie, than is where this line should point to. Also, if status is the name of the movie, and not a VARIABLE, than you need to change the line to whatever.the.path.is.status.text = "blah blah blah".

If this is still not clear to you, you'll have to read the basic tutorials Flash comes with.

emilioestevezz
09-06-2004, 02:39 PM
Is your movie INSIDE the button? Or next to it? When you double click on the button in the work area, it the status movieclip there, or not? If it's there than the code shoud work, if it's not, than find where it is, and that is where you have to point the "status =" line to.
For example: If your button is on the _root (on stage, not in ANY OTHER MOVIE), and it has the name of "myButton", then the path to it would be "_root.myButton". If the status movie is inside your button, than the path to it would ne "_root.myButton.status". BUT, if the status movie is next to the button (I.E. on STAGE), than the path to it would be "_root.status", and not "_root.myButton.status".

Now... if it is on the STAGE, then the line of code in your button action should be _root.status = "blah blah blah", if not, then whatever the path is to you status movie, than is where this line should point to. Also, if status is the name of the movie, and not a VARIABLE, than you need to change the line to whatever.the.path.is.status.text = "blah blah blah".

If this is still not clear to you, you'll have to read the basic tutorials Flash comes with.


Ok, first of all, thanks for patience.

Now, i can say that status is on stage near submit btn, its a textbox with dinamic text property, the variable name is status and the instance name given is tb_status: iīve tried the code with this but nothing happens:

userData.sendAndLoad("inserta.php", _root.tb_status, "POST");
_root.tb_status.onLoad = insertaReplyFUNC(success);
function insertaReplyFUNC(success) {
if (success) {
_root.tb_status = "Datos Guardados!";
} else {
_root.tb_status = "Error al guardar los datos!";
}
}

Iīve also tried with _root.status but still nothing! any idea?

Emilio

deQue
09-06-2004, 03:24 PM
_root.tb_status should be _root.tb_status.text

emilioestevezz
09-06-2004, 03:38 PM
_root.tb_status should be _root.tb_status.text

Well, is not working , but thanks anyway iīve improved it very much since te beggining ! and its not fare to get your time for it.
Maybe you can recomend me a tut so i can make some research. There must be some missing steps in the last art of the code or maybe in the php page that pass data to mysql server.

deQue
09-06-2004, 03:46 PM
Found your problem:
_root.tb_status.onLoad = insertaReplyFUNC(success); should be: _root.tb_status.onLoad = insertaReplyFUNC;

emilioestevezz
09-06-2004, 04:30 PM
Found your problem:
_root.tb_status.onLoad = insertaReplyFUNC(success); should be: _root.tb_status.onLoad = insertaReplyFUNC;

darn form, hes just playing with us!!!! :mad:
When checking syntax on the scrit is all ok, no errors, but when i try it, input all fields and submit nothing happens.

If you like i can send you the .fla

There must be something im not defining i mean its logical and its all setted then why in the name of bill this script isnīt warking.

deQue
09-06-2004, 04:41 PM
It wont help, unless your PHP is located on a public server, cause I can't access your local server for this.

emilioestevezz
09-06-2004, 05:44 PM
It wont help, unless your PHP is located on a public server, cause I can't access your local server for this.

nope, its located on a server here.

Anyway i paste the variables get from the php page:

$apellidoclientesnuevos = $_POST['apellido'];
$nombreclientesnuevos = $_POST['nombre'];
$telefonoclientesnuevos = $_POST['telefono'];
$dniclientesnuevos = $_POST['dni'];
$fechacitaclientesnuevos = $_POST['fecha'];
$horacitaclientesnuevos = $_POST['hora'];
$abogadoclientesnuevos = $_POST['abogado'];
$asuntoclientesnuevos = $_POST['asunto'];
$dondeclientesnuevos = $_POST['donde'];