Flash Store (sólo un problem.Suming valores), por favor ayuda
- rmarin
- Newbie


- Registrado: Dic 10, 2008
- Mensajes: 5
- Status: Offline
Hola a todos
google para mi problema me acaban aquí y me di cuenta rápidamente este es un gran lugar y tantas cosas que ayudaron a resolver todos los...Espero poder ayudar también...
tengo una tienda de flash que se carga de xmls ..
todo está funcionando bien, pero no puedo resolver la suma / eliminación de los campos (los productos)
devuelve NaN de error
o sólo el producto que se añade última
my_nstep. valor es un menú desplegable donde elegimos Cant.
valor.text es el precio en la descripción del producto
myDP_array creats el producto, Quant, y el precio
la suma está aquí:
Este es el código completo si ayuda a
google para mi problema me acaban aquí y me di cuenta rápidamente este es un gran lugar y tantas cosas que ayudaron a resolver todos los...Espero poder ayudar también...
tengo una tienda de flash que se carga de xmls ..
todo está funcionando bien, pero no puedo resolver la suma / eliminación de los campos (los productos)
devuelve NaN de error
o sólo el producto que se añade última
my_nstep. valor es un menú desplegable donde elegimos Cant.
valor.text es el precio en la descripción del producto
myDP_array creats el producto, Quant, y el precio
la suma está aquí:
Código: [ Select ]
botao.onPress = function ()
{
fim.enabled = true;
var _loc2 = Number(my_nstep.value * valor.text);
myDP_array.push({Produto: nome.text, Qtd: my_nstep.value, Preço: _loc2});
my_dg.dataProvider = myDP_array;
var _loc1 = Number(soma.text) + _loc2;
soma.text = _loc1;
total.text = _loc1;
numero = numero + 1;
};
{
fim.enabled = true;
var _loc2 = Number(my_nstep.value * valor.text);
myDP_array.push({Produto: nome.text, Qtd: my_nstep.value, Preço: _loc2});
my_dg.dataProvider = myDP_array;
var _loc1 = Number(soma.text) + _loc2;
soma.text = _loc1;
total.text = _loc1;
numero = numero + 1;
};
- botao.onPress = function ()
- {
- fim.enabled = true;
- var _loc2 = Number(my_nstep.value * valor.text);
- myDP_array.push({Produto: nome.text, Qtd: my_nstep.value, Preço: _loc2});
- my_dg.dataProvider = myDP_array;
- var _loc1 = Number(soma.text) + _loc2;
- soma.text = _loc1;
- total.text = _loc1;
- numero = numero + 1;
- };
Este es el código completo si ayuda a
Código: [ Select ]
function preencher()
{
var _loc2 = container.attachMovie("item_mc", "i[" + coluna + "][" + linha + "]", container.getNextHighestDepth());
_loc2._x = Math.round(coluna * _loc2._width + coluna * 5);
_loc2._y = Math.round(linha * _loc2._height + linha * 5);
_loc2.url_fotop = dados[i].attributes.fotop;
_loc2.url_foto = dados[i].attributes.foto;
_loc2.nome.text = dados[i].attributes.nome;
_loc2.info = dados[i].attributes.desc;
_loc2.valor.text = dados[i].attributes.preco;
carregar.loadClip(dados[0].attributes.fotop, loader);
nome.text = dados[0].attributes.nome;
valor.text = dados[0].attributes.preco;
info.text = dados[0].attributes.desc;
_loc2.onRelease = function ()
{
carregar.loadClip(this.url_fotop, loader);
nome.text = this.nome.text;
valor.text = this.valor.text;
info.text = this.info;
};
mcs.push(_loc2);
carregar.loadClip(_loc2.url_fotop, _loc2.foto);
i++;
coluna++;
if (coluna >= qc && linha >= ql - 1)
{
return;
} // end if
if (coluna == qc && linha < ql)
{
coluna = 0;
++linha;
} // end if
if (i < len)
{
preencher(coluna, linha);
} // end if
} // End of the function
function removeAll()
{
var _loc1 = 0;
var _loc2 = mcs.length;
while (_loc1 < _loc2)
{
mcs[_loc1].removeMovieClip();
++_loc1;
} // end while
mcs = [];
} // End of the function
function ativar(num)
{
var i = 0;
while (i < qp)
{
if (num != i)
{
eval("paginacao.p" + i).enabled = true;
}
else
{
eval("paginacao.p" + i).enabled = false;
} // end else if
++i;
} // end while
} // End of the function
function criaPaginacao()
{
var _loc5 = qtd;
var _loc2 = 0;
var _loc4 = qp;
while (_loc2 < _loc4)
{
var _loc3 = paginacao.attachMovie("pag_mc", "p" + _loc2, paginacao.getNextHighestDepth());
_loc3._x = Math.round(_loc2 * _loc3._width + _loc2);
_loc3.idpag = _loc2 * (qc * ql);
_loc3.n_txt.text = _loc2 + 1;
_loc3.atual = _loc2;
_loc3.onRelease = function ()
{
removeAll();
ativar(this.atual);
i = this.idpag;
coluna = 0;
linha = 0;
preencher();
};
++_loc2;
} // end while
paginacao.p0.onRelease();
} // End of the function
var i = 0;
var coluna = 0;
var linha = 0;
var len = 0;
var dados;
var carregar = new MovieClipLoader();
var fotos = new XML();
var qc = 4;
var ql = 2;
var qp = 0;
var mcs = [];
fotos.ignoreWhite = true;
fotos.load("loja.xml");
fotos.onLoad = function ()
{
if (fotos.loaded == true)
{
dados = this.firstChild.childNodes;
len = dados.length;
qp = Math.ceil(len / (qc * ql));
if (qp > 1)
{
criaPaginacao();
delete prencher();
}
else if (qp <= 1)
{
preencher();
delete criaPaginacao();
paginacao.unloadMovie();
} // end if
} // end else if
};
stop ();
my_dg.setStyle("alternatingRowColors", [16777215, 16250871]);
my_dg.setStyle("borderStyle", "solid");
var myDP_array = new Array();
var conta = new Number();
var numero = new Number();
my_dg.resizableColumns = false;
my_dg.sortableColumns = false;
deleta.enabled = false;
fim.enabled = false;
my_dg.onLoad = function ()
{
myDP_array.push({Produto: algo, Qtd: algo, Preço: algo});
my_dg.dataProvider = myDP_array;
var _loc1 = my_dg.getColumnAt(0);
_loc1.width = 140;
my_dg.removeAll();
};
botao.onPress = function ()
{
fim.enabled = true;
var _loc2 = Number(my_nstep.value * valor.text);
myDP_array.push({Produto: nome.text, Qtd: my_nstep.value, Preço: _loc2});
my_dg.dataProvider = myDP_array;
var _loc1 = Number(soma.text) + _loc2;
soma.text = _loc1;
total.text = _loc1;
numero = numero + 1;
};
fim.onPress = function ()
{
bt1.enabled = false;
bt2.enabled = false;
bt3.enabled = false;
bt4.enabled = false;
botao.enabled = false;
fim.enabled = false;
my_nstep.enabled = false;
check._visible = true;
produtos._visible = false;
container.unloadMovie();
paginacao.unloadMovie();
};
myGridListener = new Object();
myGridListener.change = function (eventObj)
{
deleta.enabled = true;
var eventSource = Number(my_dg.selectedItem.Preço);
deleta.onPress = function ()
{
if (my_dg.selectedIndex != undefined)
{
my_dg.removeItemAt(my_dg.selectedIndex);
var _loc2 = Number(eventSource);
var _loc1 = total.text - eventSource;
total.text = _loc1;
deleta.enabled = false;
numero = numero - 1;
if (numero == 0)
{
fim.enabled = false;
} // end if
} // end if
};
};
my_dg.addEventListener("change", myGridListener);
if (numero == 0)
{
deleta.enabled = false;
}
else
{
deleta.enabled = true;
} // end else if
bt1.onPress = function ()
{
fotos.load("loja.xml");
};
bt2.onPress = function ()
{
fotos.load("loja2.xml");
};
bt3.onPress = function ()
{
fotos.load("loja3.xml");
};
bt4.onPress = function ()
{
fotos.load("loja4.xml");
};
{
var _loc2 = container.attachMovie("item_mc", "i[" + coluna + "][" + linha + "]", container.getNextHighestDepth());
_loc2._x = Math.round(coluna * _loc2._width + coluna * 5);
_loc2._y = Math.round(linha * _loc2._height + linha * 5);
_loc2.url_fotop = dados[i].attributes.fotop;
_loc2.url_foto = dados[i].attributes.foto;
_loc2.nome.text = dados[i].attributes.nome;
_loc2.info = dados[i].attributes.desc;
_loc2.valor.text = dados[i].attributes.preco;
carregar.loadClip(dados[0].attributes.fotop, loader);
nome.text = dados[0].attributes.nome;
valor.text = dados[0].attributes.preco;
info.text = dados[0].attributes.desc;
_loc2.onRelease = function ()
{
carregar.loadClip(this.url_fotop, loader);
nome.text = this.nome.text;
valor.text = this.valor.text;
info.text = this.info;
};
mcs.push(_loc2);
carregar.loadClip(_loc2.url_fotop, _loc2.foto);
i++;
coluna++;
if (coluna >= qc && linha >= ql - 1)
{
return;
} // end if
if (coluna == qc && linha < ql)
{
coluna = 0;
++linha;
} // end if
if (i < len)
{
preencher(coluna, linha);
} // end if
} // End of the function
function removeAll()
{
var _loc1 = 0;
var _loc2 = mcs.length;
while (_loc1 < _loc2)
{
mcs[_loc1].removeMovieClip();
++_loc1;
} // end while
mcs = [];
} // End of the function
function ativar(num)
{
var i = 0;
while (i < qp)
{
if (num != i)
{
eval("paginacao.p" + i).enabled = true;
}
else
{
eval("paginacao.p" + i).enabled = false;
} // end else if
++i;
} // end while
} // End of the function
function criaPaginacao()
{
var _loc5 = qtd;
var _loc2 = 0;
var _loc4 = qp;
while (_loc2 < _loc4)
{
var _loc3 = paginacao.attachMovie("pag_mc", "p" + _loc2, paginacao.getNextHighestDepth());
_loc3._x = Math.round(_loc2 * _loc3._width + _loc2);
_loc3.idpag = _loc2 * (qc * ql);
_loc3.n_txt.text = _loc2 + 1;
_loc3.atual = _loc2;
_loc3.onRelease = function ()
{
removeAll();
ativar(this.atual);
i = this.idpag;
coluna = 0;
linha = 0;
preencher();
};
++_loc2;
} // end while
paginacao.p0.onRelease();
} // End of the function
var i = 0;
var coluna = 0;
var linha = 0;
var len = 0;
var dados;
var carregar = new MovieClipLoader();
var fotos = new XML();
var qc = 4;
var ql = 2;
var qp = 0;
var mcs = [];
fotos.ignoreWhite = true;
fotos.load("loja.xml");
fotos.onLoad = function ()
{
if (fotos.loaded == true)
{
dados = this.firstChild.childNodes;
len = dados.length;
qp = Math.ceil(len / (qc * ql));
if (qp > 1)
{
criaPaginacao();
delete prencher();
}
else if (qp <= 1)
{
preencher();
delete criaPaginacao();
paginacao.unloadMovie();
} // end if
} // end else if
};
stop ();
my_dg.setStyle("alternatingRowColors", [16777215, 16250871]);
my_dg.setStyle("borderStyle", "solid");
var myDP_array = new Array();
var conta = new Number();
var numero = new Number();
my_dg.resizableColumns = false;
my_dg.sortableColumns = false;
deleta.enabled = false;
fim.enabled = false;
my_dg.onLoad = function ()
{
myDP_array.push({Produto: algo, Qtd: algo, Preço: algo});
my_dg.dataProvider = myDP_array;
var _loc1 = my_dg.getColumnAt(0);
_loc1.width = 140;
my_dg.removeAll();
};
botao.onPress = function ()
{
fim.enabled = true;
var _loc2 = Number(my_nstep.value * valor.text);
myDP_array.push({Produto: nome.text, Qtd: my_nstep.value, Preço: _loc2});
my_dg.dataProvider = myDP_array;
var _loc1 = Number(soma.text) + _loc2;
soma.text = _loc1;
total.text = _loc1;
numero = numero + 1;
};
fim.onPress = function ()
{
bt1.enabled = false;
bt2.enabled = false;
bt3.enabled = false;
bt4.enabled = false;
botao.enabled = false;
fim.enabled = false;
my_nstep.enabled = false;
check._visible = true;
produtos._visible = false;
container.unloadMovie();
paginacao.unloadMovie();
};
myGridListener = new Object();
myGridListener.change = function (eventObj)
{
deleta.enabled = true;
var eventSource = Number(my_dg.selectedItem.Preço);
deleta.onPress = function ()
{
if (my_dg.selectedIndex != undefined)
{
my_dg.removeItemAt(my_dg.selectedIndex);
var _loc2 = Number(eventSource);
var _loc1 = total.text - eventSource;
total.text = _loc1;
deleta.enabled = false;
numero = numero - 1;
if (numero == 0)
{
fim.enabled = false;
} // end if
} // end if
};
};
my_dg.addEventListener("change", myGridListener);
if (numero == 0)
{
deleta.enabled = false;
}
else
{
deleta.enabled = true;
} // end else if
bt1.onPress = function ()
{
fotos.load("loja.xml");
};
bt2.onPress = function ()
{
fotos.load("loja2.xml");
};
bt3.onPress = function ()
{
fotos.load("loja3.xml");
};
bt4.onPress = function ()
{
fotos.load("loja4.xml");
};
- function preencher()
- {
- var _loc2 = container.attachMovie("item_mc", "i[" + coluna + "][" + linha + "]", container.getNextHighestDepth());
- _loc2._x = Math.round(coluna * _loc2._width + coluna * 5);
- _loc2._y = Math.round(linha * _loc2._height + linha * 5);
- _loc2.url_fotop = dados[i].attributes.fotop;
- _loc2.url_foto = dados[i].attributes.foto;
- _loc2.nome.text = dados[i].attributes.nome;
- _loc2.info = dados[i].attributes.desc;
- _loc2.valor.text = dados[i].attributes.preco;
- carregar.loadClip(dados[0].attributes.fotop, loader);
- nome.text = dados[0].attributes.nome;
- valor.text = dados[0].attributes.preco;
- info.text = dados[0].attributes.desc;
- _loc2.onRelease = function ()
- {
- carregar.loadClip(this.url_fotop, loader);
- nome.text = this.nome.text;
- valor.text = this.valor.text;
- info.text = this.info;
- };
- mcs.push(_loc2);
- carregar.loadClip(_loc2.url_fotop, _loc2.foto);
- i++;
- coluna++;
- if (coluna >= qc && linha >= ql - 1)
- {
- return;
- } // end if
- if (coluna == qc && linha < ql)
- {
- coluna = 0;
- ++linha;
- } // end if
- if (i < len)
- {
- preencher(coluna, linha);
- } // end if
- } // End of the function
- function removeAll()
- {
- var _loc1 = 0;
- var _loc2 = mcs.length;
- while (_loc1 < _loc2)
- {
- mcs[_loc1].removeMovieClip();
- ++_loc1;
- } // end while
- mcs = [];
- } // End of the function
- function ativar(num)
- {
- var i = 0;
- while (i < qp)
- {
- if (num != i)
- {
- eval("paginacao.p" + i).enabled = true;
- }
- else
- {
- eval("paginacao.p" + i).enabled = false;
- } // end else if
- ++i;
- } // end while
- } // End of the function
- function criaPaginacao()
- {
- var _loc5 = qtd;
- var _loc2 = 0;
- var _loc4 = qp;
- while (_loc2 < _loc4)
- {
- var _loc3 = paginacao.attachMovie("pag_mc", "p" + _loc2, paginacao.getNextHighestDepth());
- _loc3._x = Math.round(_loc2 * _loc3._width + _loc2);
- _loc3.idpag = _loc2 * (qc * ql);
- _loc3.n_txt.text = _loc2 + 1;
- _loc3.atual = _loc2;
- _loc3.onRelease = function ()
- {
- removeAll();
- ativar(this.atual);
- i = this.idpag;
- coluna = 0;
- linha = 0;
- preencher();
- };
- ++_loc2;
- } // end while
- paginacao.p0.onRelease();
- } // End of the function
- var i = 0;
- var coluna = 0;
- var linha = 0;
- var len = 0;
- var dados;
- var carregar = new MovieClipLoader();
- var fotos = new XML();
- var qc = 4;
- var ql = 2;
- var qp = 0;
- var mcs = [];
- fotos.ignoreWhite = true;
- fotos.load("loja.xml");
- fotos.onLoad = function ()
- {
- if (fotos.loaded == true)
- {
- dados = this.firstChild.childNodes;
- len = dados.length;
- qp = Math.ceil(len / (qc * ql));
- if (qp > 1)
- {
- criaPaginacao();
- delete prencher();
- }
- else if (qp <= 1)
- {
- preencher();
- delete criaPaginacao();
- paginacao.unloadMovie();
- } // end if
- } // end else if
- };
- stop ();
- my_dg.setStyle("alternatingRowColors", [16777215, 16250871]);
- my_dg.setStyle("borderStyle", "solid");
- var myDP_array = new Array();
- var conta = new Number();
- var numero = new Number();
- my_dg.resizableColumns = false;
- my_dg.sortableColumns = false;
- deleta.enabled = false;
- fim.enabled = false;
- my_dg.onLoad = function ()
- {
- myDP_array.push({Produto: algo, Qtd: algo, Preço: algo});
- my_dg.dataProvider = myDP_array;
- var _loc1 = my_dg.getColumnAt(0);
- _loc1.width = 140;
- my_dg.removeAll();
- };
- botao.onPress = function ()
- {
- fim.enabled = true;
- var _loc2 = Number(my_nstep.value * valor.text);
- myDP_array.push({Produto: nome.text, Qtd: my_nstep.value, Preço: _loc2});
- my_dg.dataProvider = myDP_array;
- var _loc1 = Number(soma.text) + _loc2;
- soma.text = _loc1;
- total.text = _loc1;
- numero = numero + 1;
- };
- fim.onPress = function ()
- {
- bt1.enabled = false;
- bt2.enabled = false;
- bt3.enabled = false;
- bt4.enabled = false;
- botao.enabled = false;
- fim.enabled = false;
- my_nstep.enabled = false;
- check._visible = true;
- produtos._visible = false;
- container.unloadMovie();
- paginacao.unloadMovie();
- };
- myGridListener = new Object();
- myGridListener.change = function (eventObj)
- {
- deleta.enabled = true;
- var eventSource = Number(my_dg.selectedItem.Preço);
- deleta.onPress = function ()
- {
- if (my_dg.selectedIndex != undefined)
- {
- my_dg.removeItemAt(my_dg.selectedIndex);
- var _loc2 = Number(eventSource);
- var _loc1 = total.text - eventSource;
- total.text = _loc1;
- deleta.enabled = false;
- numero = numero - 1;
- if (numero == 0)
- {
- fim.enabled = false;
- } // end if
- } // end if
- };
- };
- my_dg.addEventListener("change", myGridListener);
- if (numero == 0)
- {
- deleta.enabled = false;
- }
- else
- {
- deleta.enabled = true;
- } // end else if
- bt1.onPress = function ()
- {
- fotos.load("loja.xml");
- };
- bt2.onPress = function ()
- {
- fotos.load("loja2.xml");
- };
- bt3.onPress = function ()
- {
- fotos.load("loja3.xml");
- };
- bt4.onPress = function ()
- {
- fotos.load("loja4.xml");
- };
- Anonymous
- Bot


- Registrado: 25 Feb 2008
- Mensajes: ?
- Loc: Ozzuland
- Status: Online
Diciembre 10th, 2008, 6:26 am
- rmarin
- Newbie


- Registrado: Dic 10, 2008
- Mensajes: 5
- Status: Offline
- ATNO/TW
- Super Moderator


- Registrado: May 28, 2003
- Mensajes: 23403
- Loc: Woodbridge VA
- Status: Offline
- rmarin
- Newbie


- Registrado: Dic 10, 2008
- Mensajes: 5
- Status: Offline
- ATNO/TW
- Super Moderator


- Registrado: May 28, 2003
- Mensajes: 23403
- Loc: Woodbridge VA
- Status: Offline
Bueno, NaN es, obviamente, "no es un número" y su siempre va a venir cuando una variable es un error - por lo general cuando su no declarado. Su duro para mí porque me miró rápidamente y no está seguro exactamente donde todas las variables se están definiendo etc Usted sabe mejor que nadie, pero que está recibiendo el NaN porque es una variable de follar.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
Página 1 de 1
Para responder a este tema que necesita para ingresar o registrarse. Es gratis.
Publicar Información
- Total de mensajes en este tema: 5 mensajes
- Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 50 invitados
- No puede abrir nuevos temas en este Foro
- No puede responder a temas en este Foro
- No puede editar sus mensajes en este Foro
- No puede borrar sus mensajes en este Foro
- No puede enviar adjuntos en este Foro
