Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a dynamic menu with information from XML

Status
Not open for further replies.

webscriptprogrammer

Programmer
Nov 26, 2005
31
SE
Hi

I have read a very long thread here (thread250-908402) and
I like very much the dynamicportfolio example that I have download.

I have never use XMLConnector or DataSet in flash before.
I understand some code but not all but I soon get it.

I try too make a category system so the flash read the XML file and see how many category the flash need too add in a list so I only need too choose a category and the show in the menu.

The problem is that I not so many idea howto make the first read how many category that XML file have and post it in a list and then make the flash only read that category I have choose.

I can see in the field name in XMLConnector how he pick the "portfolio" in the XML file and then show it on the flash with help of DataSet.
 
Add each record in the dataset to an array. Then use the array as your menu data source.

Hope that helps.

Wow JT that almost looked like you knew what you were doing!
 
I have a idea that maybe work.

in the XML file:
Code:
<category>
<item id="1" name="cat1" title="Category 1" />
<item id="2" name="cat2" title="Category 2" />
<item id="3" name="cat2" title="Category 3" />
</category>

<cat1>
 <item id="1" title="Web Site 1" imageURL="images/site1.jpg" url="images/site1.gif" summary="This is a summary of site 1" />
 <item id="2" title="Web Site 2" imageURL="images/site2.jpg" url="images/site2.gif" summary="This is a summary of site 2" />
<item id="3" title="Web Site 3" imageURL="images/site3.jpg" url="images/site3.gif" summary="This is a summary of site 3" />
</cat1>

<cat2>
 <item id="1" title="Web Site 1" imageURL="images/site1.jpg" url="images/site1.gif" summary="This is a summary of site 1" />
 <item id="2" title="Web Site 2" imageURL="images/site2.jpg" url="images/site2.gif" summary="This is a summary of site 2" />
<item id="3" title="Web Site 3" imageURL="images/site3.jpg" url="images/site3.gif" summary="This is a summary of site 3" />
</cat2>

<cat3>
 <item id="1" title="Web Site 1" imageURL="images/site1.jpg" url="images/site1.gif" summary="This is a summary of site 1" />
 <item id="2" title="Web Site 2" imageURL="images/site2.jpg" url="images/site2.gif" summary="This is a summary of site 2" />
<item id="3" title="Web Site 3" imageURL="images/site3.jpg" url="images/site3.gif" summary="This is a summary of site 3" />
</cat3>

I have all category first of the XML file and under I have information of each category.

But I dont now yet how I can in a actionscript tell XMLConnector to change what XML element he going to use.

Like I say, have never use XMLConnector

 
That XML format wouldn't really give you a schema you could work with. Here's an example using the menubar component. The trick isn't really the XMLConnector, but it is the manipulation of the dataset.

Get it Here

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Wow very nice example. Like it very much

I can see a little how you have done too make the category to work.

I going too try and see how I can fix so it work in the other menu I going to use.

I like dynamicportfolio that use scrollpane so I can have a nice menu with picture and some information and use a ComboBox where I can choose the category.

This is going to be fun, I dont have use the XML so much only when I need to insert infomation in a combobox or a list. That way I never have use a XMLConnector or dataset.

 
Hmm not so easy :)
I have try too create something basic like two list, one for the category and one for the name.
That work almost perfect, the list the category but the other list show every name that is inside the XML file.

I need too create a "if" or something like that so it only show the name that have same category.

 
Now I'm almost done but I have one problem.

I can load the MC inside scrollpane but when I try to reload the MC (I have a category list beside) then the load the MC above the other MC so it dont look nice at all.

I have try
Code:
unloadMovie("targetClip");
and
Code:
scroller.clear();
 
I try to make a loop that check if that is any MC and delete them.

The MC have name stage0, stage1, stag2, .........

How can I do that

I going to use removeMovieClip() function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top