I’m trying to create an gallery application that reads the pics from the server per category (= directory).
I do this using a PHP that creates the XML file:
HTML-code:
[COLOR=#000080]<?xml version=[COLOR=#0000ff]“1.0”[/COLOR] encoding=[COLOR=#0000ff]“utf-8”[/COLOR] ?>[/COLOR] - [COLOR=#000080]<categories>[/COLOR]- [COLOR=#000080]<category name=[COLOR=#0000ff]“Categorie1”[/COLOR]>[/COLOR][COLOR=#000080]<image name=[COLOR=#0000ff]“cat1Pic1.jpg”[/COLOR] />[/COLOR] [COLOR=#000080]<image name=[COLOR=#0000ff]“cat1Pic2.jpg”[/COLOR] />[/COLOR] [COLOR=#000080]</category>[/COLOR]- [COLOR=#000080]<category name=[COLOR=#0000ff]“Categorie2”[/COLOR]>[/COLOR][COLOR=#000080]<image name=[COLOR=#0000ff]“cat2Pic1.jpg”[/COLOR] />[/COLOR] [COLOR=#000080]<image name=[COLOR=#0000ff]“cat2Pic2.jpg”[/COLOR] />[/COLOR] [COLOR=#000080]<image name=[COLOR=#0000ff]“cat2Pic3.jpg”[/COLOR] />[/COLOR] [COLOR=#000080]<image name=[COLOR=#0000ff]“cat2Pic4.jpg”[/COLOR] />[/COLOR] [COLOR=#000080]</category>[/COLOR][COLOR=#000080]</categories>[/COLOR]
Now I can get to the categories(= directories) using this code:
ActionScript 3 Code:
[LEFT][FONT=monospace][COLOR=#6699cc]var[/COLOR] categoryAttributes[COLOR=#000000]:[/COLOR][COLOR=#004993]XMLList[/COLOR] = galleryInput[COLOR=#000000].[/COLOR]category[COLOR=#000000].[/COLOR][COLOR=#004993]attributes[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000];[/COLOR][/FONT]
[FONT=monospace][COLOR=#0033ff]for[/COLOR] [COLOR=#0033ff]each[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#6699cc]var[/COLOR] categoryNAME[COLOR=#000000]:[/COLOR][COLOR=#004993]XML[/COLOR] [COLOR=#0033ff]in[/COLOR] categoryAttributes[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR][/FONT]
[FONT=monospace][COLOR=#004993]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#009900]“categoryNAME:”[/COLOR] [COLOR=#000000]+[/COLOR] categoryNAME[COLOR=#000000])[/COLOR][COLOR=#000000];[/COLOR][/FONT]
[FONT=monospace][COLOR=#000000]}[/COLOR][/FONT][/LEFT]
This works, I get the directory names and create labels on stage and hang eventlisteners on them to handle user input.
The next step is to select the corresponding pictures (that are in the “current” directory) and I just can’t get it to work.
My best effort so far is the following, but this code gives me ALL pictures, not a selection…
ActionScript 3 Code:
[LEFT][FONT=monospace][COLOR=#6699cc]var[/COLOR] categoryAttributes[COLOR=#000000]:[/COLOR][COLOR=#004993]XMLList[/COLOR] = galleryInput[COLOR=#000000].[/COLOR]category[COLOR=#000000].[/COLOR][COLOR=#004993]attributes[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000];[/COLOR][/FONT]
[FONT=monospace][COLOR=#0033ff]for[/COLOR] [COLOR=#0033ff]each[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#6699cc]var[/COLOR] categoryNAME[COLOR=#000000]:[/COLOR][COLOR=#004993]XML[/COLOR] [COLOR=#0033ff]in[/COLOR] categoryAttributes[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR][/FONT]
[FONT=monospace][COLOR=#004993]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#009900]“Hier komt de categoryNAME:”[/COLOR] [COLOR=#000000]+[/COLOR] categoryNAME[COLOR=#000000])[/COLOR][COLOR=#000000];[/COLOR] [/FONT]
[FONT=monospace][COLOR=#999999]// Get the right pictures[/COLOR][/FONT]
[FONT=monospace][COLOR=#6699cc]var[/COLOR] imageAttributes[COLOR=#000000]:[/COLOR][COLOR=#004993]XMLList[/COLOR] = galleryInput[COLOR=#000000].[/COLOR]category[COLOR=#000000].[/COLOR]image[COLOR=#000000].[/COLOR][COLOR=#004993]attributes[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000];[/COLOR][/FONT][/LEFT]
[FONT=monospace][COLOR=#004993]trace[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#009900]"pictures: "[/COLOR] [COLOR=#000000]+[/COLOR] imageAttributes[COLOR=#000000])[/COLOR][COLOR=#000000];[/COLOR] [/FONT]
[INDENT][LEFT][FONT=monospace][COLOR=#0033ff]for[/COLOR] [COLOR=#0033ff]each[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#6699cc]var[/COLOR] imageNAME[COLOR=#000000]:[/COLOR][COLOR=#004993]XML[/COLOR] [COLOR=#0033ff]in[/COLOR] imageAttributes[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR][/FONT][/LEFT]
[LEFT][FONT=monospace][COLOR=#004993]trace[/COLOR] COLOR=#000000[/COLOR][COLOR=#000000];[/COLOR][/FONT][/LEFT]
[LEFT][FONT=monospace][COLOR=#004993]trace[/COLOR] COLOR=#000000[/COLOR][COLOR=#000000];[/COLOR] [/FONT]
[FONT=monospace][COLOR=#000000]}[/COLOR][/FONT][/LEFT]
[/INDENT][FONT=monospace][COLOR=#000000]}[/COLOR][/FONT]
And if I use galleryInput.category.image.name AS3 states that there are more than one value (of course).
Now i have 2 questions:
How do I limit the selection to just the images belonging to the “current” category?
Is this the right approach? or should i design it all different?
Any help is appreciated!
t.i.a.
Wullem