4 Replies Latest reply on Jul 9, 2007 4:51 PM by Genos_Free

    creationComplete Problems

    Genos_Free
      If I try to get a mxml componet that has a datagrid in it to render data how do I get the main application page to pull the data with the creation complete in the application file?
      Here is the componet (resume2.mxml) file code.
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="476" height="230">

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

      [Bindable]
      private var getSkills:ArrayCollection;

      private function skillsRPC(event:ResultEvent):void {
      getSkills = event.result.main.secondary;
      }
      ]]>
      </mx:Script>

      <mx:HTTPService id="mySkills" url="data/skills.xml"
      result="skillsRPC(event)"/>

      <mx:Label text="Skills:" fontSize="17" fontFamily="Times New Roman" enabled="true"
      fontWeight="bold" fontStyle="italic" color="#800000" textDecoration="underline"/>
      <mx:DataGrid id="myGrid" x="5" y="29" width="100%" height="194" dataProvider="{getSkills}">
      <mx:columns>
      <mx:DataGridColumn headerText="Primary Set" dataField="skill1" fontSize="10" fontStyle="normal" fontGridFitType="pixel"/>
      <mx:DataGridColumn headerText="Secondary Set" dataField="skill2" fontSize="10" fontStyle="normal" fontGridFitType="pixel"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Canvas>
      Here is the main application file code.
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      backgroundGradientColors="[#999966, #ffffff]" xmlns:ns1="components.*"
      creationComplete="resume2.skillsRPC.event.send()"
      viewSourceURL="srcview/index.html">


      <mx:Script>
      <![CDATA[

      public function getMessageBoard(event:MouseEvent):void {
      var u:URLRequest = new URLRequest(" http://www.goldmineservices.com/discussion/index.cfm");
      navigateToURL(u, "_blank");
      }

      public function getResume(event:MouseEvent):void {
      var url:URLRequest = new URLRequest(" http://www.goldmineservices.com/Current_Resume.doc");
      url.method = "GET";
      navigateToURL(url, "_blank");
      }

      public function getPublished(event:MouseEvent):void {
      var sysConURL:URLRequest = new URLRequest(" http://mxdj.sys-con.com/read/256086_p.htm");
      sysConURL.method = "GET";
      navigateToURL(sysConURL, "_blank");
      }

      ]]>
      </mx:Script>


      <mx:Style source="assets/main.css"/>

      <mx:Image source="assets/logo.png" width="300" height="50"/>

      <mx:Panel width="1100" title="Software Solutions for the Next Iteration of the WEB!"
      fontSize="13" color="#800000" horizontalAlign="left" top="54" left="9" cornerRadius="14">
      <mx:HBox backgroundColor="#cccc99">

      <mx:Accordion id="myResume" resizeToContent="true" x="68" y="58" width="500" backgroundColor="#cccc99">
      <ns1:Intro id="Intro" label="GMS - Mission Statement" x="68" y="58" width="500" height="453"/>
      <ns1:resume1 id="resume1" label="Resume Objective" x="68" y="58" width="540"/>
      <ns1:resume2 id="resume2" label="Resume Skills" x="68" y="58" width="540"/>
      <ns1:resume3 id="resume3" label="Resume Current Taskings" x="68" y="58" width="540"/>
      <ns1:resume7 id="resume7" label="Pursuits and Studies" x="68" y="58" width="540"/>
      <ns1:resume4 id="resume4" label="Resume Development Projects - (2005)" x="68" y="58" width="540"/>
      <ns1:resume5 id="resume5" label="Resume Projects 2002 - 2004" x="68" y="58" width="540"/>
      <ns1:resume6 id="resume6" label="Resume Early Projects to Current" x="68" y="58" width="540"/>
      <ns1:resumeEducation id="Education" label="Resume Education" x="68" y="58" width="540"/>
      </mx:Accordion>

      <mx:TabNavigator id="myNavigation" resizeToContent="true" x="613" y="58" width="563" backgroundColor="#cccc99">

      <ns1:Sql id="Sql" label="SQL" x="68" y="58" width="500"/>
      <ns1:Flex id="Flex" label="Web2" x="68" y="58" width="500"/>
      <ns1:DotNet id="DotNet" label="ASP.NET" x="68" y="58" width="500"/>
      <ns1:ColdFusion id="CFMX" label="CFMX" x="68" y="58" width="500"/>
      <ns1:Webservices id="webservices" label="WebServices" x="68" y="58" width="480"/>
      <ns1:SOA id="soa" label="SOA" x="68" y="58" width="480"/>
      <ns1:Contact id="contact" label="Contact" x="68" y="58" width="450"/>

      </mx:TabNavigator>
      </mx:HBox>

      <mx:HBox x="613" y="666" width="20%">
      <mx:LinkButton x="64" y="519" id="messageBoard" label="Discussion Board" enabled="true" click="getMessageBoard(event)"/>
      <mx:LinkButton x="175" y="519" label="Downloadable Resume" enabled="true" click="getResume(event)"/>
      <mx:LinkButton x="180" y="519" label="Publication" enabled="true" click="getPublished(event)"/>
      </mx:HBox>

      <mx:Image source="assets/poweredbyCFD.jpg" width="169" height="31" x="613" y="690"/>
      </mx:Panel>
      </mx:Application>
      The creation complete above is incorrect.

      Thanks in advance.
      Gene
        • 1. Re: creationComplete Problems
          ntsiii Level 3
          "resume2.skillsRPC.event.send()"

          "skillsRPC" is private and thus not accessible outside the compoent
          "skillsRPC" is a function and thus has no "event" property.
          "send()" is a method of mySkills HTTPService.

          Try: resume2.mySkills.send();

          But actually, don't. Create a public method in resume2 that actually invokes send, so that you can debug to be sure it is getting called.

          Tracy
          • 2. Re: creationComplete Problems
            Genos_Free Level 1
            Could you give me just a little more how to info.
            It would be most appreciated.

            Thanks,
            Gene
            • 3. Re: creationComplete Problems
              ntsiii Level 3
              Which part?
              Tracy
              • 4. Re: creationComplete Problems
                Genos_Free Level 1
                I finally figured it out.
                Everything I can do at the component.
                Here is an example...
                --------------------------------------
                <?xml version="1.0" encoding="utf-8"?>
                <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="476" height="390"
                initialize="myClasses.send()">

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

                [Bindable]
                private var education:ArrayCollection;

                private function myEducation(event:ResultEvent):void {
                education = myClasses.lastResult.main.classnameone;
                }

                ]]>
                </mx:Script>

                <mx:HTTPService id="myClasses" url="data/classes.xml"
                result="myEducation(event)"/>

                <mx:Label text="Classes and Training:" fontSize="17" fontFamily="Times New Roman" enabled="true"
                fontWeight="bold" fontStyle="italic" color="#800000" textDecoration="underline"/>
                <mx:DataGrid id="myGrid" x="5" y="29" width="100%" height="353" dataProvider="{education}">
                <mx:columns>
                <mx:DataGridColumn headerText="Name" dataField="skill2" fontSize="10" fontStyle="normal"/>
                </mx:columns>
                </mx:DataGrid>
                </mx:Canvas>