<mx:Button label="Create Breakfast" click="createBreakfast()"/> 
is in the main.mxml



--- In flexcoders@yahoogroups.com, claudiu ursica <the_bran...@...> wrote:
>
> when are you calling the service?
> 
> C
> 
> 
> 
> 
> ________________________________
> From: Jason B <nos...@...>
> To: flexcoders@yahoogroups.com
> Sent: Saturday, August 1, 2009 5:51:26 PM
> Subject: [flexcoders] Re: creation timing on panel component
> 
>   
> Just so you know if I use this on the component it works fine
> 
> <mx:VBox >
> <nutrition:Panelcre atemeal id="pnlCreateBreakf ast" meal="{nutritionDat 
> a.breakfast} "/>
> </mx:VBox>
> 
> 
> --- In flexcod...@yahoogro ups.com, "Jason B" <nospam@> wrote:
> >
> > Main.mxml
> > ------------ ------
> > 
> >     [Bindable]
> >     private var nutritionData: XML;
> > 
> > 
> >     //      create breakfast
> >                     private function createBreakfast( ):void
> >                     {
> >                             vsMain.selectedInde x = 1;
> >                             vsCreateMeals. selectedIndex = 0;
> >                             plantype = 'Breakfast';
> > 
> > #1009 ERROR HERE BELOW !
> >                             pnlCreateBreakfast. meal = nutritionData. 
> > breakfast;
> > 
> >                     }
> > 
> > 
> > <mx:HTTPService id="hsNutrition" url="/main.php/ flexnutrition/ 
> > nutritioncal"
> >             result="nutritionRe sultHandler( event)"
> >             fault="nutritionFau ltHandler( event)" resultFormat= "e4x"/>
> > 
> > 
> >             <mx:VBox width="100%" height="100% ">
> >                             <mx:ViewStack width="40%" height="410" 
> > borderStyle= "inset" borderThickness= "2" id="vsCreateMeals" >
> > 
> >                         <mx:VBox >
> >                                  <nutrition:Panelcre atemeal 
> > id="pnlCreateBreakf ast" />
> >                                     </mx:VBox>
> > 
> > 
> > ------------ --------- --------- --------- --------- ---------
> > panelcreatemeal. mxml
> > ------------ -
> > <?xml version="1.0" encoding="utf- 8"?>
> > <mx:Panel xmlns:mx="http://www.adobe. com/2006/ mxml" width="100%" 
> > height="390" 
> >     borderThicknessLeft ="0" borderThicknessRigh t="0" borderThicknessBott 
> > om="0"
> >     dropShadowEnabled= "false"
> >      horizontalAlign= "center" xmlns:containers= "com.dougmccune. 
> > containers. *" title="Select An Item from below" creationPolicy= "all">
> > 
> >     <mx:Script>
> >             <![CDATA[
> >                     //import com.createmealPanel ;
> > 
> >                     [Bindable]
> >                     private var _meal:XMLList;
> > 
> >                     public function set meal(value:XMLList) :void
> >                     {
> >                             if(value)
> >                             {
> >                                     _meal = value;
> >                                     createContainers( );
> >                             }
> >                     }
> > 
> >                     private function createContainers( ):void
> >                     {
> >                             for each(var item:Object in _meal.itemdata)
> >                             {
> >                                     if(item.available == "yes")
> >                                     {
> >                                             var panelcreatemealitem 
> > :Panelcreatemeal item = new Panelcreatemealitem ;
> >                                             coverflow.addChild( 
> > panelcreatemeali tem);
> >                                             panelcreatemealitem 
> > .mealDetails = item;
> >                                     }
> >                             }
> >                     }
> >             ]]>
> >     </mx:Script>
> > 
> >     <containers: CoverFlowContain er id="coverflow" width="100%" 
> > height="100% " 
> >             horizontalGap= "1" borderStyle= "inset" backgroundColor= 
> > "0xFFFFFF" 
> >             segments="9" reflectionEnabled= "true"/>
> > 
> >                  <mx:HBox>
> >                     <mx:Button label="item 1" click="parentApplic 
> > ation.vsCreateMe als.selectedInde x=0;"/>
> >                             <mx:Button label="side item 1" 
> > click="parentApplic ation.vsCreateMe als.selectedInde x=1;"/>
> >                         <mx:Button label="side item 2" click="parentApplic 
> > ation.vsCreateMe als.selectedInde x=2;"/>
> >                      </mx:HBox> 
> > </mx:Panel>
> > 
> > 
> > ------------ ---------
> > panelcreatemealitem .mxml
> > ---------
> > <?xml version="1.0" encoding="utf- 8"?>
> > <mx:Panel xmlns:mx="http://www.adobe. com/2006/ mxml" width="310" 
> > height="320" 
> >      title="{mealDetails .title}" horizontalAlign= "center" creationPolicy= 
> > "all">
> > 
> > 
> >     <mx:Metadata>
> >             [Event(name= "addToMeal" )] 
> >             [Event(name= "learnAboutThis" )] 
> >     </mx:Metadata>
> > 
> >     <mx:Script>
> >             <![CDATA[
> >                     import mx.controls. Alert;
> > 
> >                     [Bindable]
> >                     public var mealDetails: Object;
> > 
> > 
> >                     private function calldispatch( ):void {
> >                             parentApplication. createmeals_ loadswf_var = 
> > mealDetails. swf;
> >                             dispatchEvent( new Event('learnAboutTh is', 
> > true));
> > 
> >                     }
> > 
> >             ]]>
> >     </mx:Script>
> > 
> >     <mx:Image source="{mealDetail s.imgsource }" width="285" height="159" />
> > 
> >     <mx:Label text="{mealDetails. serving}" />
> > 
> >     <mx:Button label="Add to Meal" click="dispatchEven t(new 
> > Event('addToMeal' , true))"/> 
> > 
> >     <mx:Button label="Learn About This" click="calldispatch ()"/>
> > 
> > </mx:Panel>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > --- In flexcod...@yahoogro ups.com, claudiu ursica <the_braniak@ > wrote:
> > >
> > > Quick and really dirty...
> > > wrap them inside a try catch block... but then I can't believe I just 
> > > said that... Share some more code and I'll come up with something more 
> > > engineering like...
> > > 
> > > C
> > > 
> > > 
> > > 
> > > 
> > > ____________ _________ _________ __
> > > From: Jason B <nospam@>
> > > To: flexcod...@yahoogro ups.com
> > > Sent: Saturday, August 1, 2009 5:25:33 PM
> > > Subject: [flexcoders] creation timing on panel component
> > > 
> > > 
> > > 
> > > I'm calling a httpservice which I populate into this nutritionData
> > > variable, I'm using a panel component to reuse it, and when I call the
> > > #SETTER below it throws a 1009 error, I was wondering if the panel is
> > > not yet created, if thats the case how can i wait until the panel is
> > > created?
> > > 
> > > [Bindable]
> > > private var nutritionData: XML;
> > > 
> > > #SETTER
> > > pnlCreateBreakfast. meal = nutritionData. breakfast;
> > >
> >
>


Reply via email to