jenjenut233
05-16-2007, 06:43 PM
Hi all-
I am writing an application in Flash that will sit in an image on a CD with several PDFs (anywhere from 20 to 3000) and the app is supposed to allow users to create a search by Product Family, Product Industry, Brand and Literature Type. Then it gives results based on their selections. (Right now for testing, I just have it displaying every time a selection is made, no search button). My test2.xml file contains 4 literatures.
I'm stuck on an array problem.
function runWhenParsed(flscd:Object):Void {
// below we get the chosen options from the combobox into variables.
/*cbProdFam.changeHandler =
cbProdInd.changeHandler =
cbBrand.changeHandler =
cbLitType.changeHandler = function() {
prodFamSelected = cbProdFam.selectedItem.label;
prodIndSelected = cbProdInd.selectedItem.label;
brandSelected = cbBrand.selectedItem.label;
litTypeSelected = cbLitType.selectedItem.label;
*/
count = flscd.literature.length; // 4
for (j=0;j<count;j++) { //looping through xml data to get assoc for each lit
brand = flscd.literature[j].brand.name;
litname = flscd.literature[j].text;
filepath = flscd.literature[j].filePath;
type = flscd.literature[j].type;
fam = new Array();
for (i=0;i<4;i++) {
fam[i] = flscd.literature[j].brand.families.family[i];
}
trace (litname + " " + type + " " + fam[0]);
}
}
var parsedXML:com.polygeek.utils.PXP2 = new com.polygeek.utils.PXP2("test2.xml", runWhenParsed);
Output from above is:
Actualizaciones RV9 Product Bulletins and Supplements Pumps
Accutronix MX - Spanish User Instruction Manuals (IOMs) Automation,Valves
I-75 Interface User Instruction Manuals (IOMs) Automation,Valves
CPX Pompes process-chimie ISO Bulletin Product Bulletins and Supplements Pumps
If I change:
fam = new Array();
for (i=0;i<4;i++) {
fam[i] = flscd.literature[j].brand.families.family;
}
trace (litname + " " + type + " " + fam[0]);
to:
fam = new Array();
for (i=0;i<4;i++) {
fam[i] = flscd.literature[j].brand.families.family[i];
}
trace (litname + " " + type + " " + fam[0]);
Output is:
Actualizaciones RV9 Product Bulletins and Supplements undefined
Accutronix MX - Spanish User Instruction Manuals (IOMs) Automation
I-75 Interface User Instruction Manuals (IOMs) Automation
CPX Pompes process-chimie ISO Bulletin Product Bulletins and Supplements undefined
After it is changed, noticed the undefined family for the first and last. But before it is changed, the second and third have both families together separated by a comma.
Please advise as to how I can correct this. Also if anyone has any suggestions on a better way to do this type of application, any help will be greatly appreciated. Thanks in advance.
I am writing an application in Flash that will sit in an image on a CD with several PDFs (anywhere from 20 to 3000) and the app is supposed to allow users to create a search by Product Family, Product Industry, Brand and Literature Type. Then it gives results based on their selections. (Right now for testing, I just have it displaying every time a selection is made, no search button). My test2.xml file contains 4 literatures.
I'm stuck on an array problem.
function runWhenParsed(flscd:Object):Void {
// below we get the chosen options from the combobox into variables.
/*cbProdFam.changeHandler =
cbProdInd.changeHandler =
cbBrand.changeHandler =
cbLitType.changeHandler = function() {
prodFamSelected = cbProdFam.selectedItem.label;
prodIndSelected = cbProdInd.selectedItem.label;
brandSelected = cbBrand.selectedItem.label;
litTypeSelected = cbLitType.selectedItem.label;
*/
count = flscd.literature.length; // 4
for (j=0;j<count;j++) { //looping through xml data to get assoc for each lit
brand = flscd.literature[j].brand.name;
litname = flscd.literature[j].text;
filepath = flscd.literature[j].filePath;
type = flscd.literature[j].type;
fam = new Array();
for (i=0;i<4;i++) {
fam[i] = flscd.literature[j].brand.families.family[i];
}
trace (litname + " " + type + " " + fam[0]);
}
}
var parsedXML:com.polygeek.utils.PXP2 = new com.polygeek.utils.PXP2("test2.xml", runWhenParsed);
Output from above is:
Actualizaciones RV9 Product Bulletins and Supplements Pumps
Accutronix MX - Spanish User Instruction Manuals (IOMs) Automation,Valves
I-75 Interface User Instruction Manuals (IOMs) Automation,Valves
CPX Pompes process-chimie ISO Bulletin Product Bulletins and Supplements Pumps
If I change:
fam = new Array();
for (i=0;i<4;i++) {
fam[i] = flscd.literature[j].brand.families.family;
}
trace (litname + " " + type + " " + fam[0]);
to:
fam = new Array();
for (i=0;i<4;i++) {
fam[i] = flscd.literature[j].brand.families.family[i];
}
trace (litname + " " + type + " " + fam[0]);
Output is:
Actualizaciones RV9 Product Bulletins and Supplements undefined
Accutronix MX - Spanish User Instruction Manuals (IOMs) Automation
I-75 Interface User Instruction Manuals (IOMs) Automation
CPX Pompes process-chimie ISO Bulletin Product Bulletins and Supplements undefined
After it is changed, noticed the undefined family for the first and last. But before it is changed, the second and third have both families together separated by a comma.
Please advise as to how I can correct this. Also if anyone has any suggestions on a better way to do this type of application, any help will be greatly appreciated. Thanks in advance.