<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Development Soup &#187; 3.0</title>
	<atom:link href="https://dreamwagon.com/blog/?feed=rss2&#038;tag=30" rel="self" type="application/rss+xml" />
	<link>https://dreamwagon.com/blog</link>
	<description></description>
	<lastBuildDate>Sun, 03 Aug 2014 23:22:50 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.8.41</generator>
	<item>
		<title>flex accordion navigation xml updated for 3.0</title>
		<link>https://dreamwagon.com/blog/?p=16</link>
		<comments>https://dreamwagon.com/blog/?p=16#comments</comments>
		<pubDate>Tue, 03 Jun 2008 23:11:43 +0000</pubDate>
		<dc:creator><![CDATA[Jesse]]></dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[3]]></category>
		<category><![CDATA[3.0]]></category>
		<category><![CDATA[accordion]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[flex3.0]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://dreamwagon.com/blog/?p=16</guid>
		<description><![CDATA[Since it seems I get much traffic from the accordion navigation, I decided to come up with a new example updated for flex 3.0. I left the flexlib out in this version, so the mxml should compile by itself. Also,&#8230;  <p class="more-link"><a href="https://dreamwagon.com/blog/?p=16">Continue reading <span class="meta-nav">&#8594;</span></a></p>]]></description>
				<content:encoded><![CDATA[<p>Since it seems I get much traffic from the accordion navigation, I decided to come up with a new example updated for flex 3.0.</p>
<p>I left the flexlib out in this version, so the mxml should compile by itself. Also, to make this example even more dynamic, I use some php along with a flash variable to ready the url of the httpService at page load. This makes it possible to load different XML documents, and therefore create different navs based on&#8230;well whatever you want. For this example I use rand(1,2) to pick randomly between 2 different properties files.</p>
<p>Here is the example</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Application</span> <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;*&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">layout</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span> <span style="color: #000066;">viewSourceURL</span>=<span style="color: #ff0000;">&quot;srcview/index.html&quot;</span> <span style="color: #000066;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#ffffff&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">creationComplete</span>=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #339933;">&lt;![CDATA[</span>
&nbsp;
<span style="color: #339933;">import mx.collections.ArrayCollection;</span>
<span style="color: #339933;">import mx.utils.ArrayUtil;</span>
<span style="color: #339933;">import mx.rpc.events.ResultEvent;</span>
<span style="color: #339933;">//[Bindable]</span>
<span style="color: #339933;">//public var navData:ArrayCollection;</span>
&nbsp;
<span style="color: #339933;">[Bindable]public var str:String;</span>
&nbsp;
<span style="color: #339933;">[Bindable] public var httpServiceURL:String;</span>
<span style="color: #339933;">[Bindable] public var appHeight:Number;</span>
<span style="color: #339933;">[Bindable] public var appWidth:Number;</span>
&nbsp;
<span style="color: #339933;">[Bindable]public var xmlData:Object = new Object();</span>
<span style="color: #339933;">[Bindable]public var headingData:Object = new Object();</span>
<span style="color: #339933;">[Bindable]public var linkData:Object = new Object();</span>
&nbsp;
<span style="color: #339933;">private function init():void{</span>
<span style="color: #339933;">httpServiceURL=Application.application.parameters.httpServiceURL;</span>
<span style="color: #339933;">appHeight=Application.application.parameters.appHeight</span>
<span style="color: #339933;">appWidth=Application.application.parameters.appHeight</span>
<span style="color: #339933;">srv.send();</span>
<span style="color: #339933;">}</span>
&nbsp;
<span style="color: #339933;">private function getHeadings(evt:ResultEvent):void{</span>
<span style="color: #339933;">xmlData = evt.result;</span>
<span style="color: #339933;">headingData = xmlData.a_nav;</span>
<span style="color: #339933;">}</span>
&nbsp;
<span style="color: #339933;">private function getLinkObject(a:Number):Object{</span>
<span style="color: #339933;">linkData = headingData.heading[a];</span>
<span style="color: #339933;">return linkData;</span>
<span style="color: #339933;">}</span>
&nbsp;
<span style="color: #339933;">]]&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
Application {
backgroundGradientColors: #FFFFFF, #FFFFFF;
backgroundGradientAlphas: 1, 1;
vertical-align: top;
horizontal-align: center;
padding-top: 0px;
padding-left: 5px;
padding-right: 0px;
}
&nbsp;
Accordion {
textRollOverColor: #FFFFFF;
textSelectedColor: #FFFFFF;
color: #FFFFFF;
headerHeight: 35;
vertical-gap: 5;
background-alpha:0;
open-duration:500;
border-style:none;
&nbsp;
}
&nbsp;
.gradientHeaderSquare {
font-family: Verdana;
borderColors: #AAB1CD, #AAB1CD;
overBorderColors: #FFFFFF, #FFFFFF;
selectedBorderColors: #FFFFFF, #FFFFFF;
borderThickness: 2;
color: #FFFFFF;
borderAlpha: 1;
fillColors: #7f8182, #7f8182;
fillAlphas: 1, 1;
fillColorRatios: 0, 255;
overFillColors: #FFFFFF, #FFFFFF;
overFillAlphas: 1, 1;
overFillColorRatios: 0, 169;
selectedFillColors:#000000, #000000;
selectedFillAlphas: 1,1;
fontSize: 13;
padding-left: 10px;
padding-top: 0px;
}
&nbsp;
.gradientHeaderRound {
cornerRadius: 20;
font-family: Verdana;
borderColors: #AAB1CD, #AAB1CD;
overBorderColors: #FFFFFF, #FFFFFF;
selectedBorderColors: #FFFFFF, #FFFFFF;
borderThickness: 2;
color: #FFFFFF;
borderAlpha: 1;
fillColors: #7f8182, #7f8182;
fillAlphas: 1, 1;
fillColorRatios: 0, 255;
overFillColors: #FFFFFF, #FFFFFF;
overFillAlphas: 1, 1;
overFillColorRatios: 0, 169;
selectedFillColors:#000000, #000000;
selectedFillAlphas: 1,1;
fontSize: 13;
padding-left: 10px;
padding-top: 0px;
}
&nbsp;
LinkButton {
fontSize: 10px;
rollOverColor: #fafafa;
selectionColor: #fafafa;
color: #0B357F;
textRollOverColor: #25bbfc;
textSelectedColor: #0B357F;
padding-left: 15px;
padding-top: 5px;
}
&nbsp;
.headerBox {
font-weight: bold;
color: #FFFFFF;
}
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:HTTPService</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;srv&quot;</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;{httpServiceURL}&quot;</span> <span style="color: #000066;">resultFormat</span>=<span style="color: #ff0000;">&quot;object&quot;</span> <span style="color: #000066;">result</span>=<span style="color: #ff0000;">&quot;getHeadings(event);&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Accordion</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;accordion&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;{appHeight}&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;{appWidth}&quot;</span> <span style="color: #000066;">headerStyleName</span>=<span style="color: #ff0000;">&quot;gradientHeaderRound&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Repeater</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;rep&quot;</span> <span style="color: #000066;">dataProvider</span>=<span style="color: #ff0000;">&quot;{headingData.heading}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:VBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;{rep.currentItem.title}&quot;</span> <span style="color: #000066;">styleName</span>=<span style="color: #ff0000;">&quot;headerBox&quot;</span> <span style="color: #000066;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#fafafa&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;{rep.currentItem.width}&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;{rep.currentItem.height}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Repeater</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;rep2&quot;</span> <span style="color: #000066;">dataProvider</span>=<span style="color: #ff0000;">&quot;{getLinkObject(rep.currentIndex).link}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:LinkButton</span> <span style="color: #000066;">buttonDown</span>=<span style="color: #ff0000;">&quot;navigateToURL(new URLRequest(event.currentTarget.getRepeaterItem()), '_top')&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;{rep2.currentItem.linkname}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Repeater</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:VBox<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Repeater<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Accordion<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>as you can see for this example I have decided to use Object instead of ArrayCollection. I just found it easier to get the data than using e4x.</p>
<p>Download the complete example to see how the index file that embeds this swf generates the service that will be used to create the navigation.</p>
<p><a title="Flex3.0AccordionNavigationXML" href="http://www.dreamwagon.com/flex/examples/accordionupdate/index.html.php" target="_blank">Here is the result</a></p>
<p><a title="Flex3.0AccordionNavigationXML" href="http://www.dreamwagon.com/flex/examples/accordionupdate/Flex3.0AccordionNavigationXML.rar" target="_blank">Here is the full source</a></p>
<p>Updated: 6-12-08 : I had a needless function that was causing a bug. Works as it should now <img src="https://dreamwagon.com/blog/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /> </p>
]]></content:encoded>
			<wfw:commentRss>https://dreamwagon.com/blog/?feed=rss2&#038;p=16</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
