Hi,
I am putting together a survey system in Flex2 (my 1st major Flex
project). I am basically taking an accordion (called accSurvey) and
embedding an accordion in each pocket. Then finally I will put a
datagrid in each pocket of the subaccordions. The pockets were all
implemented by writing them as a component.mxml and instantiating them
on the fly at runtime (createChild). The creations are working fine if
no data is involved but, I use data to define the survey structure. So I
use flash remoting into a cfc to get data from SqlServer 2K5 for
defining the survey structure. What I am running into is this I get the
initial data in the main initApp() from
<mx:RemoteObject
id="ro"
destination="ColdFusion"
source="mpdb.InterPlanSurvey.cfc.survey"
showBusyCursor="true">
<mx:method
name="getSectionGroups"
result="populateSectionGroups(event)"/>
<mx:method
name="getSections"
result="populateSectionGroups(event)"/>
</mx:RemoteObject>
So far so good.
I then create the pockets for the top level accordion:
public function initApp():void{
ro.getSectionGroups();
}
public function
populateSectionGroups(event:ResultEvent):void{
for( var i:int = 0; i < event.result.length; i++
){
addSectionGroupToAcc(event.result[i]);
trace(event.result[i].SectionGroupText);
}
}
public function
addSectionGroupToAcc(sectiongroupObj:Object):void{
var newSectionGroup:SectionGroup = new
SectionGroup();
newSectionGroup.strSurveyID =
sectiongroupObj.SID;
newSectionGroup.strSectionGroupID =
sectiongroupObj.SGID;
newSectionGroup.strSectionGroupText =
sectiongroupObj.SectionGroupText;
newSectionGroup.label =
sectiongroupObj.SectionGroupText;
accSurvey.addChild(newSectionGroup);
}
It works perfect, so if it worked before I thought, it should work again
in the component
<mx:Canvas
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:component="component.*"
width="90%"
height="90%"
creationComplete="initSections()">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
public function initSections():void{
ro.getSections();
}
[Bindable] public var
strSurveyID:String = '';
[Bindable] public var
strSectionGroupID:String = '';
[Bindable] public var
strSectionGroupText:String = '';
public function
populateSections(event:ResultEvent):void{
for( var i:int = 0; i <
event.result.length; i++ ){
addSectionToAcc(event.result[i]);
trace(event.result[i].SectionText);
}
}
public function
addSectionToAcc(sectionObj:Object):void{
var newSection:Section =
new Section();
//newSection.strSurveyID
= sectionObj.SID;
//newSection.strSectionGroupID = sectionObj.SGID;
//newSection.strSectionID = sectionObj.SECID;
newSection.label =
sectionObj.SectionText;
accSections.addChild(newSection);
}
<mx:RemoteObject
id="ro"
destination="ColdFusion"
source="mpdb.InterPlanSurvey.cfc.survey"
showBusyCursor="true">
<mx:method
name="getSections"
result="populateSections(event)"/>
</mx:RemoteObject>
]]>
</mx:Script>
<mx:Accordion id="accSections" width="95%" height="95%"
horizontalCenter="0" verticalCenter="10">
</mx:Accordion>
</mx:Canvas>
But, it won't compile. I get:
Severity Description Resource In Folder
Location Creation Time Id
2 1120: Access of undefined property ro. SectionGroup.mxml
InterPlanSurvey/component line 16 February 9, 2007 4:13:37 PM
196
Which is:
public function initSections():void{
ro.getSections();
}
I get the feeling I should be able to do all the datacalls from the main
mxml and access them from the sublevel components code but, haven't
seemed to find the documentation on how to do that either.
Why can't it resolve at this point? Is it because all the resolving was
done in the main mxml and I'm trying to do this connection while running
and dynamic binding isn't allowed?
I've been looking for a good white paper on multiple remoting objects on
different levels and found NaDa. Has anyone done this yet and willing to
share???
Help!!!!!!!!
Thanks,
Gerald
The information contained in this communication is highly confidential and is
intended solely for the use of the individual(s) to whom this communication is
directed. If you are not the intended recipient, you are hereby notified that
any viewing, copying, disclosure or distribution of this information is
prohibited. Please notify the sender, by electronic mail or telephone, of any
unintended receipt and delete the original message without making any copies.
Blue Cross Blue Shield of Michigan and Blue Care Network of Michigan are
nonprofit corporations and independent licensees of the Blue Cross and Blue
Shield Association.