PDA

View Full Version : FComboBox not displaying items


TheLostMarble
07-22-2003, 05:32 PM
I am loading data from an XML file and populating a combobox (cbCompanies) using the following code:

myMembers = new Array(); // for storing data to be placed in the combobox

// Open the XML database
myXMLDB = new XML();
myXMLDB.ignoreWhite = true;
myXMLDB.onLoad = function(success) {
if (success) {
xmlDatabase = myXMLDB.firstChild.childNodes;

// Loop through the XML db & select only certain records
for (var i = 0; i < xmlDatabase.length; i++) {
myKids = xmlDatabase[i].childNodes;
for (var j = 0; j < myKids.length; j++) {
if (myKids[j].nodeName == "Member") {
tmpObj = new Object();
tmpObj.label = myKids[j].parentNode.attributes.name;
tmpObj.data = j;
myMembers[myMembers.length] = tmpObj;
break;
}
}
}
cbCompanies.setDataProvider(myMembers);
cbCompanies.sortItemsBy("label", "ASC");
} else {
trace("ERROR!");
}
}
myXMLDB.load("../../membership.xml");

When I test this within the Flash MX IDE, it works as I would expect. However, when I publish the swf, only the first item in the list is displayed in the static portion of the combobox. The dropdown list is empty. It does look as if it has loaded the values because the scrollbar will scroll as if something is there.

I am not attaching the FComboBox dynamically, I have it included and named on the stage already.

It would make more sense to me if it just did not work. However, it does work when I perform a Test Movie within Flash.

Has anyone encountered this prob & know of the fix?
Thanks!

freddycodes
07-22-2003, 07:03 PM
Can you show us the structure of the XML file?

TheLostMarble
07-22-2003, 08:07 PM
Sure... but like I said, the whole thing works in the Flash authoring environment. I cannot imagine any problems with the structure that would allow it to work there, but not when it is published....


<?xml version="1.0" ?>
<Database>
<Company name="companyA" id="cA" password="cAPW" question="Standard Question" answer="Standard Answer" newsletter="1" url="http://www.someurlforcompanyA.org">
<Member name="Fred Flintstone" street="" bldg="" city="" state="TX" zip="" phone="(555) 555-5555" fax="" cell="" email="[email protected]" />
</Company>
<Company name="companyB" id="cB" password="cBPW" question="Standard Question" answer="Standard Answer" newsletter="1" url="http://www.someurlforcompanyB.org">
<Member name="Ralph Cramden" street="" bldg="" city="" state="TX" zip="" phone="(555) 555-5555" fax="" cell="" email="[email protected]" />
</Company>

.
.
.
</Database>

freddycodes
07-22-2003, 08:20 PM
I guess what I am trying to say is, something is causing it to mess up, but from the info given its tough to tell. Would you be willing to post an .fla and xml doc, to play with?

CyanBlue
07-22-2003, 08:39 PM
Um... I just copied and pasted what you have right there and it is working as it should be... I get to see four items in the comboBox...
http://www.cfhosting.it/CyanBlue/Tests/Here/Membership/membership.html

Maybe You might want to check your Flash Player version???
The newest one is FP 6.0.79.0...

TheLostMarble
07-22-2003, 09:07 PM
Well, I have been trying to upload the file, but I cannot get it compressed small enough. I must be right at the size limit, because the file just is not that large.

In any case, I saw CyanBlue's post & this is interesting. I retried my file and it does work... kind of.

I am loading this swf into another swf. For example, this page is called page_nominations.swf. I am loading it into another 'master' swf file - august2003.swf. In fact, I have a whole list of pages I am loading at runtime into the master swf.
So, the user loads august2003.swf (by way of an html page), which in turn loads each of it's child pages one at a time. page_nominations.swf is one of those pages.

When I run this page by itself, the combobox works without any problems. However, when I load it into the master swf, the combobox no longer functions properly.

Now then, this page, and all of the other 'child' pages, are being loaded into a clip which is masked.

I seem to remember some problem with masking a component. I'll try removing the mask & see what happens. If this is the problem, though, I think I am just as stuck. The mask is required...
grrrrr

Thanks anyhow to both of you for your help. At least I can see the problem now.

TheLostMarble
07-22-2003, 09:15 PM
No such luck. I removed the mask and it still will not work when loaded into another swf.

Back to square one...

TheLostMarble
07-22-2003, 09:26 PM
Ok. I do not know why this fixed the problem, but in the interests of knowledge sharing, I figure I should report this...

To recap the problem: I am loading 'child' swf's into another 'master' swf. In one 'child' swf, I used a combobox to display data from an xml file. Run by itself, this child swf works just fine. When loaded into the master swf, it - the combobox in the child swf - no longer worked.

The fix seems to be to include the FComboBox component in the master swf. I did this by adding it to a layer in the master fla, then I deleted it. The library, however, retained the combobox definition. This seems to have fixed the problem. Go figure.

I do not understand why this works, but it does.
Cheers.

CyanBlue
07-23-2003, 12:50 AM
Howdy... ;)

So, you are loading the file into the other Flash movie, right???

I did a quick test and I didn't need to have the library item existed in the main file...

Check this page out and the sample file...
http://www.cfhosting.it/CyanBlue/Tests/Here/Membership/main.html

TheLostMarble
07-23-2003, 03:31 PM
Well, burst my bubble, why dont you. :)

Here I was all proud of myself for actually figuring it out. If you got it to work without jumping through the same hoops I did, I am at a loss.

Perhaps I need to redownload the components? Maybe I have something messed up? I have been experiencing a number of problems lately - my biggest one being that my Intuos2 tablet seems to be crashing Flash on a regular basis. I have recently uninstalled Flash and reinstalled it. I may have messed something up in the process.

Thanks again for your help!

CyanBlue
07-23-2003, 08:07 PM
I had no intention of making you sad, mad or angry... :)

I have given you another example that does what you have explained because I thought that there is something else that's causing the problem... As you can see my example, you don't need to have the component in the library of the main flash movie...

Yes... It could be some setup thing... It is always a good thing to have the right ingredients to make a good soup... Installing a new copy of the Flash was a good idea, and you might want to download the FUI Component sets from the Macromedia and install them again to make sure you get the right one... (Intuos2 tablet... I don't know what this is, but if it is another form of the component, you might want to do the same thing...)

But, before you do any of those, try this first...
Create a new movie that has similar or the same script as mine for the main movie file...
Create the one that loads XML file into the combobox...
What I am saying is don't use mine... Create your version of what I have given you and test it to see if that works for you...

If that works, it probably means that there is some screw-up on the script in your original movie...
If that doesn't work, then reinstalling the whole thing wouldn't be such a bad idea...

Just my 2 cents... :)

TheLostMarble
07-23-2003, 09:08 PM
Good points. I will try what you suggest and see what happens.

The Intuos2 is a digital tablet (works in place of a mouse). It is made by Wacom & can be a great help in drawing & such. However, it seems to be causing frequent crashes. What happens is my Flash & the Tablet both lock up & I have to reboot the system to get the tablet back. This is a whole other issue that I am going to take up with Wacom.

Anyhooo, I'll give your suggestions a try & will post the results here.

The error no longer exists in my project, and it will be Murphy's Law that I will probably not be able to reproduce the error again... that is, until I am under a crunch and do not have time for more bugs.:D

CyanBlue
07-23-2003, 09:22 PM
I don't know where or when, but I've read several threads that goes with the Flash and tablet... You might want to contact Macromedia and see what they say... ;)