07-22-2003, 05:32 PM
|
#1
|
|
Registered User
Join Date: Feb 2003
Location: Dallas, TX
Posts: 35
|
FComboBox not displaying items
I am loading data from an XML file and populating a combobox (cbCompanies) using the following code:
ActionScript 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!
|
|
|
07-22-2003, 07:03 PM
|
#2
|
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
Can you show us the structure of the XML file?
|
|
|
07-22-2003, 08:07 PM
|
#3
|
|
Registered User
Join Date: Feb 2003
Location: Dallas, TX
Posts: 35
|
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....
ActionScript Code:
<? 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>
|
|
|
07-22-2003, 08:20 PM
|
#4
|
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
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?
|
|
|
07-22-2003, 08:39 PM
|
#5
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
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/Tes...embership.html
Maybe You might want to check your Flash Player version???
The newest one is FP 6.0.79.0...
|
|
|
07-22-2003, 09:07 PM
|
#6
|
|
Registered User
Join Date: Feb 2003
Location: Dallas, TX
Posts: 35
|
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.
|
|
|
07-22-2003, 09:15 PM
|
#7
|
|
Registered User
Join Date: Feb 2003
Location: Dallas, TX
Posts: 35
|
No such luck. I removed the mask and it still will not work when loaded into another swf.
Back to square one...
|
|
|
07-22-2003, 09:26 PM
|
#8
|
|
Registered User
Join Date: Feb 2003
Location: Dallas, TX
Posts: 35
|
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.
|
|
|
07-23-2003, 12:50 AM
|
#9
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
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/Tes...ship/main.html
|
|
|
07-23-2003, 03:31 PM
|
#10
|
|
Registered User
Join Date: Feb 2003
Location: Dallas, TX
Posts: 35
|
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!
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 01:02 AM.
///
|
|