Archive for the ‘Flex 3 Action Script 3 Tutorial’ Category

Flex How to remove Duplicates from an Array

Comments Off

If you have an Array and you want to get rid of duplicates from the array, here is a little function you can order online levitra use to achieve the same.

Read More »


MultiLine Label in Flex

Comments Off

If you are using the control and the size of your text is bigger than the size of the container, you will see a cut off version of the text because by default, the Label control does not allow multiline text.

Read More »


Displaying a webcam’s video in a Flex VideoDisplay control – attachCamera(), getCamera()

No Comments »

The following example shows you how you can display a user’s webcam feed in a VideoDisplay control using the static Camera.getCamera() method and VideoDisplay class’s attachCamera() method.

Read More »


Displaying dynamically loaded XML in a DataGrid control in Flex – QName

No Comments »
<?xml version="1.0" encoding="utf-8"?>
<mx:Application   name="DataGrid_XML_test"
          xmlns:mx="http://www.adobe.com/2006/mxml"
          xmlns:net="flash.net.*"
          layout="vertical"
          verticalAlign="middle"
          backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.events.ListEvent;
            import mx.controls.dataGridClasses.DataGridColumn;

                public namespace sitemapNS = "http://www.google.com/schemas/sitemap/0.84";

              private function loadXML(targetURL:String):void {
                urlLdr.load(new URLRequest(targetURL));
                loadBtn.enabled   = false;
            }

            private function urlLdr_complete(evt:Event):void {
                  var xmlData:XML = new XML(URLLoader(evt.currentTarget).data);
                  xmlListColl = new XMLListCollection(xmlData.children());
                dataGrid.enabled = true;
                  loadBtn.enabled = true;
              }

            private function dataGrid_labelFunc(item:XML, col:DataGridColumn):String {
                var   qN:QName = new QName(sitemapNS, col.dataField);
                return item[qN].text();
            }

              private function dataGrid_dateLabelFunc(item:XML, col:DataGridColumn):String {
                var qN:QName = new QName(sitemapNS, col.dataField);
                var value:String = item[qN].text();
                value = value.replace(/-/g, "/");
                  value = value.replace("T",   " ");
                value = value.replace("+00:00",   "");
                  return value;
            }

            private function dataGrid_itemDoubleClick(evt:ListEvent):void   {
                use namespace sitemapNS;
                var url:String = evt.itemRenderer.data.loc;
                navigateToURL(new URLRequest(url), "_blank");
            }
        ]]>
    </mx:Script>

      <net:URLLoader   id="urlLdr"
            complete="urlLdr_complete(event);" />
    <mx:XMLListCollection id="xmlListColl" />

    <mx:ApplicationControlBar dock="true">
        <mx:Button id="loadBtn"
                label="Load XML"
                click="loadXML('http://www.beasrilankan.com/sitemap.xml');"   />
        <mx:Spacer   width="100%" />
          <mx:ProgressBar id="progressBar"
                    mode="event"
                source="{urlLdr}"
                labelPlacement="center" />
    </mx:ApplicationControlBar>

    <mx:DataGrid   id="dataGrid"
              dataProvider="{xmlListColl}"
            doubleClickEnabled="true"
              itemDoubleClick="dataGrid_itemDoubleClick(event);"
              enabled="false"
              width="100%"
              height="100%">
            <mx:columns>
            <mx:DataGridColumn   dataField="loc"
                    labelFunction="dataGrid_labelFunc"
                      itemRenderer="mx.controls.Label"   />
            <mx:DataGridColumn   dataField="lastmod"
                    labelFunction="dataGrid_dateLabelFunc"
                      width="150" />
            <mx:DataGridColumn dataField="changefreq"
                    labelFunction="dataGrid_labelFunc"
                    width="100" />
              <mx:DataGridColumn   dataField="priority"
                    labelFunction="dataGrid_labelFunc"
                    width="100" />
        </mx:columns>
    </mx:DataGrid>

</mx:Application>

Incoming search terms:

Read More »


Collapsible Panel Component for Flex

No Comments »

Here’s an another post in the same vein as my previous one: this time, the component I’m sharing is a Panel subclass that allows for collapsing and expanding its contents. What this means is that the user can click on the header of the Panel to make it toggle between an open or closed state, with a smooth animation.
I Tried to implement the component so that it’ll be easy to use in both MXML and ActionScript. In the demo app there is also an example on styling the CollapsiblePanel.

Read More »