Slide 37 - First Hello World Application: Id "Mypanel"
Slide 37 - First Hello World Application: Id "Mypanel"
Slide (clicktest.mxml)
Demo of using <mx:script> to include functionality
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
public function copy():void
{
destination.text=source.text;
destination2.text=source.text;
}
</mx:Script>
<mx:TextInput id="source" width="100" x="97" y="53" text="Copy me
places"/>
<mx:Button label="Copy" click="copy()" x="116" y="83"/>
<mx:TextInput id="destination" width="100" x="97" y="113"/>
<mx:TextInput id="destination2" text="" x="296" y="113"/>
</mx:Application>
Project Browser:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" cornerRadius="12" backgroundGradientAlphas="[1.0, 1.0]"
backgroundGradientColors="[#FD0303, #FEBCBC]">
<mx:Text text="Enter URL and hit enter" fontFamily="Arial" fontSize="16"
fontWeight="bold"/>
<mx:TextInput id="urlTxt" width="100%" enter="html.location=urlTxt.text"
text="http://www.adobe.com" />
<mx:HTML id="html" width="100%" height="100%"
location="http://www.adobe.com" />
</mx:WindowedApplication>
<coord>
<X>56.1</X>
<Y>0.45</Y>
</coord>
<coord>
<X>67.23</X>
<Y>0.98</Y>
</coord>
</LineString>
</lineStringMember>
<lineStringMember value="2">
<LineString>
<coord><X>46.71</X><Y>9.25</Y></coord>
<coord><X>56.88</X><Y>10.44</Y></coord>
</LineString>
</lineStringMember>
<lineStringMember value="3">
<LineString>
<coord><X>324.1</X><Y>219.7</Y></coord>
<coord><X>0.45</X><Y>4.56</Y></coord>
</LineString>
</lineStringMember>
</MultiLineString>
]]>
</mx:Script>
<!--Note that I am very lazy and these are not actually executing, they are simply
making pre-executed statements visible.
I have not lost any sleep over this since it demonstrates the functions nicely. If
you lose sleep, you can re-code ;-)-->
<mx:TabNavigator x="12" y="10" width="544" height="565">
<mx:Canvas label="Statements 1" width="100%" height="632">
<mx:Label id="XCoordinate" visible="false"
text="{myGMLData.lineStringMember[0].LineString.coord[1].X}" x="131" y="40"
width="305" fontWeight="bold" color="#e82d1b"/>
<mx:Button x="30" y="10" label="Execute" click="XCoordinate.visible=true"/>
<mx:Label x="129" y="12" text="lineStringMember[0].LineString.coord[0].X"
width="327.5"/>
<mx:Text x="30" y="40" text="Result:" width="72" textAlign="right"/>
<mx:HRule x="30" y="77" width="362"/>
<mx:Label id="YCoordinate" visible="false"
text="{myGMLData.lineStringMember[0].LineString.coord.Y[0]}" x="131" y="117"
width="307" fontWeight="bold" color="#e82d1b"/>
<mx:Button x="30" y="87" label="Execute" click="YCoordinate.visible=true"/>
<mx:Label x="131" y="89" text="lineStringMember[0].LineString.coord.Y[0]"
width="327.5"/>
</mx:Canvas>
<mx:Canvas label="Statements 2" width="100%" height="100%">
<!--PARENTHESIS: Filters the XML fragment based on X having an exact value of
324.1-->
<mx:Label id="Parenthesis" visible="false"
text="{myGMLData.lineStringMember.LineString.coord.(X == 324.1)}" height="68"
width="233" x="111" y="50" fontWeight="bold" color="#e8371c"/>
<mx:Button x="10" y="20" label="Execute" click="Parenthesis.visible=true"/>
<mx:Text x="10" y="50" text="Result:" width="72" textAlign="right"/>
<mx:Label x="111" y="22" text="lineStringMember.LineString.coord.(X ==
324.1)"/>
<mx:HRule x="10" y="126" width="362"/>
<!--COMBINATION example. Note use of math operators which cast values to
integers-->
<mx:Label id="combination" visible="false"
text="{myGMLData.lineStringMember..coord.(Y == 10.44)}" height="80"
width="326" x="111" y="164" fontWeight="bold" color="#e9441c"/>
<mx:Button x="10" y="138" label="Execute" click="combination.visible=true"/>
<mx:Text x="10" y="168" text="Result:" width="72" textAlign="right"/>
<mx:Label x="111" y="140" text="lineStringMember..coord.(Y == 10.44)"/>
<mx:HRule x="10" y="243" width="362"/>
<!--DESCENDENT: returns all instances of Y that are descendents of
lineStringMember-->
<mx:Label id="Descendent" visible="false"
text="{myGMLData.lineStringMember..Y}" height="87" width="235" x="111"
y="281" fontWeight="bold" color="#e9471b"/>
<mx:Button x="10" y="253" label="Execute" click="Descendent.visible=true"/>
<mx:Text x="10" y="283" text="Result:" width="72" textAlign="right"/>
<mx:Label x="111" y="255" text="lineStringMember..Y (all instances of Y)"
width="247"/>
<mx:HRule x="10" y="369" width="362"/>
<!--ATTRIBUTE: returns the attribute-->
<mx:Label id="Attribute" visible="false" text="{myGMLData.lineStringMember.
(@value = 2)}" x="111" y="405" width="261" height="105" fontWeight="bold"
color="#e9431b"/>
<Y>219.7</Y>"/>
<mx:Text x="107" y="374" text="<X>0.45</X>
<Y>4.56</Y>"/>
</mx:Canvas>
</mx:TabNavigator>
</mx:ApolloApplication>