2 Replies Latest reply on Jan 28, 2007 4:16 AM by Miran Loncaric

    Need some good advices please

    Miran Loncaric
      HI!

      I am new to Flex 2, and also in AS 3.
      I've tried Flex 1.5 for about two years ago, but it was too hard for me(didn't knew very much of AS2)...
      So now, after five years of programming in Flash and about three years of programming in ActionScript 2, I've decided to try Flex again.

      So... because I'm new to AS 3 and Flex, I'm asking you for help and advices...

      OK... here is my first site in Flex:
      EduSLO

      At this time I'm having problems with Error 1009...
      ...some containers can't get data from xml file in the right time...

      PS: some names of variables are in slovenian language, so sorry for that.

      Thanks in advance!

      mloncaric
        • 1. Re: Need some good advices please
          Miran Loncaric Level 1
          ...here is the updated code...

          <?xml version="1.0" encoding="iso-8859-1"?>

          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" pageTitle="EduSLO" applicationComplete="{meniXML.send()}" backgroundGradientColors="[#aaddff, #99ccff]">
          <mx:HTTPService id="meniXML" url="../meni.xml" result="onLoadXML()" />

          <mx:Script>
          <![CDATA[
          import mx.collections.ArrayCollection;

          [Bindable] private var meniDP:ArrayCollection = new ArrayCollection();
          [Bindable] private var podmeniDP:ArrayCollection = new ArrayCollection();
          [Bindable] private var txtSStr:String = new String();
          [Bindable] private var prIMGSrc:String = new String();
          [Bindable] private var prTXTStr:String = new String();
          [Bindable] private var opTXTStr:String = new String();
          [Bindable] private var pzTLDP:ArrayCollection = new ArrayCollection();

          private function onLoadXML():void
          {
          meniDP = meniXML.lastResult.meni.gumb;
          }

          private function meniHandler():void
          {
          if(meniXML.lastResult.meni.gumb[meni.selectedIndex].hasOwnProperty("gumb"))
          {
          podmeniP.title = "Podmeni - "+meniXML.lastResult.meni.gumb[meni.selectedIndex].label;
          podmeniDP = meniXML.lastResult.meni.gumb[meni.selectedIndex].gumb;
          }

          if(meniXML.lastResult.meni.gumb[meni.selectedIndex].type == "simple")
          {
          vsebina.selectedChild = simple;
          }

          if(meniXML.lastResult.meni.gumb[meni.selectedIndex].type == "complex")
          {
          vsebina.selectedChild = complex;
          }
          }

          private function podmeniHandler():void
          {
          if(meniXML.lastResult.meni.gumb[meni.selectedIndex].type == "simple")
          {
          txtSStr = podmeni.selectedItem.content;
          }

          if(meniXML.lastResult.meni.gumb[meni.selectedIndex].type == "complex")
          {
          vsebinaP.title = podmeni.selectedItem.label;

          prIMGSrc = meniXML.lastResult.meni.gumb[meni.selectedIndex].gumb[podmeni.selectedIndex].predstavitev .img;
          prTXTStr = meniXML.lastResult.meni.gumb[meni.selectedIndex].gumb[podmeni.selectedIndex].predstavitev .content;

          opTXTStr = meniXML.lastResult.meni.gumb[meni.selectedIndex].gumb[podmeni.selectedIndex].content;

          pzTLDP = meniXML.lastResult.meni.gumb[meni.selectedIndex].gumb[podmeni.selectedIndex].slike.slika. source;
          }
          }
          ]]>
          </mx:Script>

          <mx:Panel horizontalScrollPolicy="auto" verticalScrollPolicy="auto" layout="absolute" title="EduSLO" id="main" width="100%" height="100%" minWidth="800" minHeight="600">
          <mx:VBox id="vb" left="0" right="0" top="0" bottom="0">
          <mx:Panel id="meniP" title="Glavni meni" width="100%">
          <mx:ToggleButtonBar id="meni" dataProvider="{meniDP}" itemClick="meniHandler()"/>
          </mx:Panel>

          <mx:HBox id="hdb" width="100%" height="100%">
          <mx:Panel id="podmeniP" title="Podmeni" height="100%">
          <mx:List id="podmeni" height="100%" width="100%" dataProvider="{podmeniDP}" click="podmeniHandler()"/>
          </mx:Panel>

          <mx:Panel id="vsebinaP" title="Vsebina" height="100%" width="100%">
          <mx:ViewStack id="vsebina" resizeToContent="true" width="100%" height="100%">
          <mx:Canvas id="simple" width="100%" height="100%">
          <mx:TextArea id="txtS" text="{txtSStr}" editable="false" wordWrap="true" left="0" right="0" top="0" height="100%"/>
          </mx:Canvas>

          <mx:Canvas id="complex" width="100%" height="100%">
          <mx:TabNavigator resizeToContent="true" id="tn" height="100%" left="0" right="0" top="0">
          <mx:Canvas id="prTN" label="Predstavitev" width="100%" height="100%">
          <mx:VBox left="0" right="0" top="0" height="100%">
          <mx:Image y="0" id="prIMG" source="{prIMGSrc}" x="0"/>
          <mx:TextArea id="prTXT" text="{prTXTStr}" editable="false" wordWrap="true" height="100%" width="100%"/>
          </mx:VBox>
          </mx:Canvas>

          <mx:Canvas id="opTN" label="Opis programa" width="100%" height="100%">
          <mx:TextArea id="opTXT" text="{opTXTStr}" editable="false" wordWrap="true" height="100%" width="100%"/>
          </mx:Canvas>

          <mx:Canvas id="pzTN" label="Posnetki zaslona" width="100%" height="100%">
          <mx:TileList dataProvider="{pzTLDP}" itemRenderer="mx.controls.Image" left="0" right="0" top="0" height="100%" id="pzTL"/>
          </mx:Canvas>

          <mx:Canvas id="fvTN" label="Flash Video" width="100%" height="100%">
          </mx:Canvas>

          <mx:Canvas id="pnTN" label="Prenesi narocilnico" width="100%" height="100%">
          </mx:Canvas>

          <mx:Canvas id="kzTN" label="Kupi zdaj" width="100%" height="100%">
          </mx:Canvas>
          </mx:TabNavigator>
          </mx:Canvas>
          </mx:ViewStack>
          </mx:Panel>
          </mx:HBox>
          </mx:VBox>
          </mx:Panel>
          </mx:Application>
          • 2. Re: Need some good advices please
            Miran Loncaric Level 1
            Here is sample xml file:
            <?xml version="1.0" encoding="iso-8859-1"?>

            <meni>
            <gumb label="Domov" type="simple">
            <gumb label="O nas" content="sample content" />
            <gumb label="S cim se ukvarjamo" content="sample content" />
            </gumb>

            <gumb label="Programi" type="complex">
            <gumb label="PerSys - ePeriodni sistem elementov">
            <predstavitev img="../slike/ePlaneti_main_scr.jpg" content="sample content" />

            <opis content="sample content" />

            <slike>
            <slika source="../slike/ePlaneti_main_scr.jpg" />
            </slike>
            </gumb>
            </gumb>
            </meni>

            ...I'm having problems with TileList component...

            Please, help me!...