..:: MX Studio Fóruns ::..: Passar variáveis pro PHP - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Passar variáveis pro PHP Aparece no Trace mas não no post.

#1 User is offline   pripathompson 

  • Group: Membros
  • Posts: 8
  • Joined: 26-June 07

Posted 29 June 2007 - 06:09 PM

Olá,

Estou tentando de alguma forma passar os valores de uma variável ("dados" ->que agrupa 3 outras variaveis) para o php...mas não tá passando nenhum valor. Quando eu dou o trace a resposta vai aparecendo da seguinte forma:

1;20;80|2;55;33|3;200;300|4;320;290|3;220;190|
1;20;80|2;55;33|3;200;300|4;320;290|3;220;190|1;86;113|
1;20;80|2;55;33|3;200;300|4;320;290|3;220;190|1;86;113|2;151;61|

ob.: a cada vez que eu movimento o movieclip ele adiciona um grupo de "id+x+y|"

O código do flash vai abaixo:
this.createEmptyMovieClip("conteiner", this.getNextHighestDepth());
var meuXML:XML = new XML();
var inicio:Number = 0;
meuXML.ignoreWhite = true;
meuXML.onLoad = function() {
var arrId = new Array()
var arrNome = new Array()
var arrXpos = new Array()
var arrYpos = new Array()
 	var dados="";
    var todos=meuXML.childNodes[0].childNodes
    for (i=0; i<meuXML.firstChild.childNodes.length; i++) {
        var id_user:String = (todos[i].childNodes[0].childNodes).toString();
        var nome:String = (todos[i].childNodes[1].childNodes).toString();
        var xpos:String = (todos[i].childNodes[2].childNodes).toString();
        var ypos:String = (todos[i].childNodes[3].childNodes).toString(); 
        arrXpos[i] = xpos;
        arrYpos[i] = ypos;
		arrNome[i] = nome;
		arrId[i] = id_user;
    } 

    while (inicio<arrXpos.length) { 
       	conteiner.attachMovie("carinha_feliz", "carinha_feliz"+inicio, inicio);
		var item:MovieClip = eval(conteiner["carinha_feliz"+inicio]);
		item._x = (arrXpos[inicio]);
        item._y = (arrYpos[inicio]);
		item.id = (arrId[inicio]);
		item.nome = (arrNome[inicio]);
		xPos = getProperty(item, _x);
		yPos = getProperty(item, _y);
		id = (item.id);
		nome = (item.nome);
		dados+=item.id + ";" +item._x + ";"+item._y + "|";
		item.onPress = function() {
    		this.startDrag(false,18,19,413,333);
		};
		item.onRelease = function() {
			this.stopDrag();
   			xPos = getProperty(this, _x);
   			yPos = getProperty(this, _y);
   			id_user = (this.id);
			nome = (this.nome);
			dados+=this.id + ";" +this._x + ";"+this._y + "|"
			_root.createTextField("mytext",20,20,360,300,20);
			mytext.text = ("Nome: "+nome+"   id_user: "+id_user+"   xPos:"+xPos+"   yPos: "+yPos);
			trace (dados);
		};
		inicio++;
		
    }
};

meuXML.load("uploads/user.xml");

bt_enviar.onRelease = function() {
 getURL("enviar.php", "_self", "POST");
};


Alguma idéia do que pode estar causando isso?
0

#2 User is offline   Natan 

  • Group: Moderador Global
  • Posts: 7350
  • Joined: 28-February 04

Posted 30 June 2007 - 05:08 PM

O getURL não é aconselhável utiliza-lo para enviar variáveis, para isso existe a Classe LoadVars. Seu PHP ficaria assim:

PHP
<?php
$valor = utf8_decode(@$_POST['valor']);
print "&mensagem=$valor";
?>
<?php
$valor = utf8_decode(@$_POST['valor']);
print "&mensagem=$valor";
?>


E no Flash você envia assim:

AS
var envia:LoadVars = new LoadVars();
bt_envia.onPress = function() {
   envia.valor = dados;
   envia.sendAndLoad("seu arquivo.php", envia, "POST");
   envia.onLoad = function(ok) {
      if (ok) {
         trace(this.mensagem);
      }
   }
}
var envia:LoadVars = new LoadVars();
bt_envia.onPress = function() {
envia.valor = dados;
envia.sendAndLoad("seu arquivo.php", envia, "POST");
envia.onLoad = function(ok) {
if (ok) {
trace(this.mensagem);
}
}
}


[]s
0

#3 User is offline   pripathompson 

  • Group: Membros
  • Posts: 8
  • Joined: 26-June 07

Posted 02 July 2007 - 11:22 AM

Natan,

Fiz desse jeito que você falou, mas não está indo para a página php... No flash ele dá o seguinte trace:

$valor";

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>



<body>

</body>

</html>


O fla tá abaixo:
this.createEmptyMovieClip("conteiner", this.getNextHighestDepth());
var meuXML:XML = new XML();
var inicio:Number = 0;
meuXML.ignoreWhite = true;
meuXML.onLoad = function() {
var arrId = new Array()
var arrNome = new Array()
var arrXpos = new Array()
var arrYpos = new Array()
 	var dados="";
    var todos=meuXML.childNodes[0].childNodes
    for (i=0; i<meuXML.firstChild.childNodes.length; i++) {
        var id_user:String = (todos[i].childNodes[0].childNodes).toString();
        var nome:String = (todos[i].childNodes[1].childNodes).toString();
        var xpos:String = (todos[i].childNodes[2].childNodes).toString();
        var ypos:String = (todos[i].childNodes[3].childNodes).toString(); 
        arrXpos[i] = xpos;
        arrYpos[i] = ypos;
		arrNome[i] = nome;
		arrId[i] = id_user;
    } 

    while (inicio<arrXpos.length) { 
       	conteiner.attachMovie("carinha_feliz", "carinha_feliz"+inicio, inicio);
		var item:MovieClip = eval(conteiner["carinha_feliz"+inicio]);
		item._x = (arrXpos[inicio]);
        item._y = (arrYpos[inicio]);
		item.id = (arrId[inicio]);
		item.nome = (arrNome[inicio]);
		xPos = getProperty(item, _x);
		yPos = getProperty(item, _y);
		id = (item.id);
		nome = (item.nome);
		dados+=item.id + ";" +item._x + ";"+item._y + "|"
		item.onPress = function() {
    		this.startDrag(false,18,19,413,333);
			
		};
		item.onRelease = function() {
			this.stopDrag();
   			xPos = getProperty(this, _x);
   			yPos = getProperty(this, _y);
   			id_user = (this.id);
			nome = (this.nome);
			_root.createTextField("mytext",20,10,360,330,20);
			mytext.text = ("Nome: "+nome+"   id_user: "+id_user+"   xPos:"+xPos+"   yPos: "+yPos);
			dados+=id + ";" +xPos + ";"+yPos + "|";
		};
		inicio++;
    }
			var envia:LoadVars = new LoadVars();
			bt_enviar.onRelease = function() {
			   envia.valor = dados;
			   envia.sendAndLoad("enviar2.php", envia, "POST");
			   envia.onLoad = function(ok) {
				  if (ok) {
					 trace(this.mensagem);
				  }
			   }
			}
};

meuXML.load("uploads/user.xml");


O que eu estou fazendo de errado?
0

#4 User is offline   pripathompson 

  • Group: Membros
  • Posts: 8
  • Joined: 26-June 07

Posted 02 July 2007 - 06:59 PM

alguém????please?

unsure.gif
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




2 User(s) are reading this topic
0 membro(s), 2 visitante(s) e 0 membros anônimo(s)