4 Replies Latest reply on Sep 5, 2008 5:35 AM by aruvasavi

    Acceesing problem

    aruvasavi
      Hi

      Following is my peace of code...

      <mx:TabNavigator x="0" y="0" width="1000" height="800" >
      <mx:Canvas label="DASHBOARD" width="100%" height="100%" id="DASHBOARD">
      <mx:Button x="119" y="243" label="PAN" id="PAN"/>
      <mx:Button x="119" y="309" label="ZOOM" id="ZOOM"/>
      </mx:Canvas>
      </mx:TabNavigator>

      In my action script "PAN.enabled = false;" is not working!!
      How to disable PAN button in Action script!! What's wrong with it!!
      How to proceed to disable PAN button in AS3????


      Thanks in Advance
      Aruna.S.N.

        • 1. Re: Acceesing problem
          dietmar.paulus
          Hey

          there is nothing wrong with your code, it just belongs where you write your actionscript code.

          if you write it in the scrrpt-Tag which is in the same file than the tabNavigator with the canvas and the buttons, this code will work without any problem, but if you want to enable the PAN-Button outside this component (in another as or mxml-File) you cannot reference to PAN. Therefore you should use the getChildByName()-methods

          cheers

          dietmar
          • 2. Re: Acceesing problem
            aruvasavi Level 1
            My peace of MXML and XML file is as follows...
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
            initialize="initializeHandler();">
            <mx:XML id="tempXML"
            source="assets/access.xml"/>
            <mx:TabNavigator x="0" y="0" width="1000" height="800" >
            <mx:Canvas label="DASHBOARD" width="100%" height="100%" id="DASHBOARD">
            <mx:Button x="119" y="243" label="PAN" id="PAN"/>
            </mx:Canvas>
            </mx:TabNavigator>
            <mx:Script>
            <![CDATA[
            private function initializeHandler():void
            {
            if( tempXML.group[0].name == "Security"){
            if(tempXML.group .noaccess1 == "PAN")
            {
            PAN.enabled = false;
            }
            }

            XML file is as below...
            <Menu>
            <group>
            <name>Security </name>
            <noaccess1>PAN</noaccess1>
            <noaccess2>TILT</noaccess2>
            <noaccess3>ZOOM</noaccess3>
            <noaccess4>PATROL</noaccess4>
            <noaccess5>TOPOLOGY</noaccess5>
            <noaccess6>CONFIGURATION</noaccess6>
            <noaccess7>ADMIN</noaccess7>
            </group>
            </Menu>
            In my action script "PAN.enabled = false;" is not working!!

            Whats wrong with it???

            Thanks n Regards
            Aruna.S.N.

            • 3. Re: Acceesing problem
              SujitG Level 2
              Hi,

              Please try invoking the initializeHandler function in creationComplete event rather than initialize event. In the initialize event, I don't think the children components are created.

              Hope this helps.
              • 4. Re: Acceesing problem
                aruvasavi Level 1
                Yes it is really helpful for me!!
                Thank u very much 4 the answer!!



                Thanks n Regards
                Aruna.S.N.