You didn’t use one of those $20/hour
offshore services did you?
I did not look at your code myself, but
Tim’s analysis will be accurate.
Tracy Spratt,
Lariat Services, development services
available
From:
Sent: Monday, July 06, 2009 12:24
PM
To:
Subject: [flexcoders] Re: getting
the xml data from a dispatched event
All I can say is that if you paid someone to write it, you should be
looking for a refund.
-TH
--- In flexcoders@yahoogro
>
> funny you mention that since I paid an experienced Flex Engineer to
build this yet I'm stuck debugging it.
> I'll see what I can do, guess it's time to learn, It's disappointing
to hear it was built wrong.
>
>
> --- In flexcoders@yahoogro
> >
> >
> > Hey Jason,
> >
> > When I created a new project with the code that you pasted, there
were
> > several bugs; including variable naming and component naming
> > mis-matches, that had to be fixed; in order to even run the
application.
> > This is what happens when you just start with an idea and add on
from
> > there; instead of planning out the application first. Because of
this,
> > the code is all over the place. I might suggest taking a step
> > backwards, and clean-up the code first. That will make it much
easier
> > to debug your issue.
> >
> > -TH
> >
> > --- In flexcoders@yahoogro
> > >
> > > I had that import in the main mxml before i replied to your
message
> > and still get an error?
> > >
> > >
> > >
> > > --- In flexcoders@yahoogro
> > > >
> > > >
> > > > import com.nutrition.
> > > >
> > > > -TH
> > > >
> > > > --- In flexcoders@yahoogro
> > > > >
> > > > >
> > > > > It wont accept your suggestions
> > > > >
> > > > > Severity and Description Path Resource Location
Creation Time
Id
> > > > > 1120: Access of undefined property Panelcreatemealitem
> > Main.mxml
> > > > line 105 1246801954900 468962
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --- In flexcoders@yahoogro
> > > > > >
> > > > > >
> > > > > > Wow, I've got to say; "What a mess."
However, you can get it
to
> > work
> > > > > > with the following changes:
> > > > > >
> > > > > > [Bindable]
> > > > > > private var customMeals:
> > XMLListCollection(
> > > > > >
> > > > > >
> > > > > >
> > > > > > // addToMeal event Handler
> > > > > > private function addToMealHandler(
> > > > > > {
> > > > > > customMeals.
> > > > > > Panelcreatemealitem
> > > > > > Alert.show(customMe
> > > > > > }
> > > > > >
> > > > > > You have some naming conflicts and, since you're
dealing
with
> > xml,
> > > > > > you'll need to use an XMLListCollection; instead
of an
> > > > ArrayCollection.
> > > > > >
> > > > > > -TH
> > > > > >
> > > > > > --- In flexcoders@yahoogro
wrote:
> > > > > > >
> > > > > > > Heres my three mxml files two of which are
under the com/
> > folder
> > > > and
> > > > > > get imported...hope that helps
> > > > > > >
> > > > > > >
> > > > > > > <?xml version="1.0"
encoding="utf-
> > > > > > > <mx:Application xmlns:mx="http://www.adobe.
> > > > > > layout="vertical"
> > > > > > > creationComplete=
> > > > > > xmlns:nutrition=
> > > > > > > paddingLeft=
> > > > paddingBottom=
> > > > > > >
> > > > > > > <mx:Script>
> > > > > > > <![CDATA[
> > > > > > > import mx.collections.
> > > > > > > import mx.collections.
> > > > > > > import mx.collections.
> > > > > > > import com.nutrition.
> > > > > > > import mx.controls.
> > > > > > > import mx.rpc.events.
> > > > > > > import mx.rpc.events.
> > > > > > > import mx.rpc.http.
> > > > > > > // initialize
> > > > > > > private function init():void
> > > > > > > {
> > > > > > > //load calories
> > > > > > > httpservice_
> > > > > > this["loadcaloriesR
> > > > > > >
> > > > > > > hsNutrition.
> > > > > > > addEventListener(
> > > > > > > addEventListener(
> > > > > > > addEventListener(
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > > > private function httpservice_
> > > > > > resulthandler:
> > > > > > >
> > > > > > > httpService.
> > > > > > >
> > > > > > > //var tmp:String = resulthandler.
> > > > > > > //if(tmp != "none")
> > > > > > > httpService.
> > resulthandler)
> > > > > > > httpService.
> > > > > > > }
> > > > > > >
> > > > > > > private function learnaboutthisswf(
> > > > > > > vfc_guy.load(
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > > > [Bindable]
> > > > > > > private var nutritionData:
> > > > > > > [Bindable]
> > > > > > > private var maindata:XML;
> > > > > > > [Bindable]
> > > > > > > public var loadswf_var:
> > > > > > > [Bindable]
> > > > > > > public var createmeals_
> > > > > > >
> > > > > > > //load all calories for main meals
> > > > > > > private function
> > loadcaloriesResultH
> > > > > > > {
> > > > > > > maindata = event.result as XML;
> > > > > > > vfc_guy.load(
> > > > > > > }
> > > > > > >
> > > > > > > // nutrition result handler
> > > > > > > private function
> > nutritionResultHand
> > > > > > > {
> > > > > > > nutritionData = event.result as XML;
> > > > > > > }
> > > > > > > // nutrition fault handler
> > > > > > > private function
nutritionFaultHandl
> > > > > > > {
> > > > > > > Alert.show(event.
> > > > > > > }
> > > > > > >
> > > > > > > // create breakfast
> > > > > > > private function createBreakfast(
> > > > > > > {
> > > > > > > vsMain.selectedInde
> > > > > > > plantype = 'Breakfast';
> > > > > > > }
> > > > > > > // create lunch
> > > > > > > private function createLunch(
> > > > > > > {
> > > > > > > vsMain.selectedInde
> > > > > > > plantype = 'Lunch';
> > > > > > > }
> > > > > > > // create dinner
> > > > > > > private function createDinner(
> > > > > > > {
> > > > > > > vsMain.selectedInde
> > > > > > > plantype = 'Dinner';
> > > > > > > }
> > > > > > >
> > > > > > > [Bindable]
> > > > > > > private var plantype:String;
> > > > > > >
> > > > > > > [Bindable]
> > > > > > > private var customMeals:
ArrayCollection;
> > > > > > >
> > > > > > > // addToMeal event Handler
> > > > > > > private function addToMealHandler(
> > > > > > > {
> > > > > > > trace(event.
> > > > > > > //customMeals.
mealitem).mealDetai
> > > > > > > Alert.show(event.
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > > > // removeMeal event Handler
> > > > > > > private function removeMealHandler(
> > > > > > > {
> > > > > > > customMeals.
> > > > > > > }
> > > > > > >
> > > > > > > ]]>
> > > > > > > </mx:Script>
> > > > > > >
> > > > > > > <mx:HTTPService
id="hsNutrition"
> > > > > > url="/main.php/
> > > > > > > result="nutritionRe
> > > > > > > fault="nutritionFau
> > > > > > >
> > > > > > > <mx:HTTPService
id="httpService" url=""
resultFormat=
> > > > > > >
> > > > > > > <mx:Label id="totalcalories"
text="{'Today\
> > based
> > > > on a
> > > > > > ' + maindata.totalcalor
fontWeight="
> > > > > > fontSize="18"
> > > > > > >
> > > > > > > <!--mx:Button label="Print Meal
Menu" /-->
> > > > > > >
> > > > > > > <mx:ViewStack id="vsMain"
width="100%" height="100%
> > > > > > >
> > > > > > > <mx:Canvas id="nutrition_
height="100%
> > > > > > >
> > > > > > > <mx:SWFLoader id="vfc_guy"
source="" height="400"
width="400"
> > > > > > autoLoad="true" x="700"
y="100" />
> > > > > > >
> > > > > > > <mx:HBox width="100%"
height="100%
> > > > > > >
> > > > > > > <mx:VBox width="40%"
height="100%
> > > > > > >
> > > > > > > <nutrition:MealPane
> > > > > > meal="{nutritionDat
> > > > > > > title="Breakfast : Please select one
meal from
> > > > > > below({maindata.
> > > > > > >
> > > > > > > <mx:HBox horizontalCenter=
> > > > > > > <mx:Button label="Create your own
Breakfast"
> > > > > > click="createBreakf
> > > > > > > </mx:HBox>
> > > > > > >
> > > > > > >
> > > > > > > <nutrition:MealPane
> > meal="{nutritionDat
> > > > > > > title="Snack : Please select one snack
from
> > > > below({maindata.
> > > > > > Cal Goal)"/>
> > > > > > > <!--mx:Button label="Create your own
Lunch"
> > > > click="createLunch(
> > > > > > >
> > > > > > > <nutrition:MealPane
> > meal="{nutritionDat
> > > > > > > title="Lunch : Please select one meal
from
> > below({maindata.
> > > >
> > > > > > Goal)"/>
> > > > > > >
> > > > > > > <nutrition:MealPane
> > meal="{nutritionDat
> > > > > > > title="Snack : Please select one snack
from
> > > > below({maindata.
> > > > > > Cal Goal)"/>
> > > > > > > <!--mx:Button label="Create your own
Dinner"
> > > > > > click="createDinner
> > > > > > >
> > > > > > > <nutrition:MealPane
> > meal="{nutritionDat
> > > > > > > title="Dinner : Please select one meal
from
> > > > below({maindata.
> > > > > > Cal Goal)"/>
> > > > > > >
> > > > > > > <nutrition:MealPane
> > meal="{nutritionDat
> > > > > > > title="Snack : Please select one snack
from
> > > > below({maindata.
> > > > > > Cal Goal)"/>
> > > > > > > </mx:VBox>
> > > > > > >
> > > > > > >
> > > > > > > </mx:HBox>
> > > > > > > </mx:Canvas>
> > > > > > >
> > > > > > >
> > > > > > > <mx:HBox width="100%"
height="100%
> > > > > > >
> > > > > > > <mx:VBox width="30%"
height="100%
> > > > > > > <mx:HBox>
> > > > > > > <mx:Label text="{'My Custom ' +
plantype}"/>
> > > > > > >
> > > > > > > </mx:HBox>
> > > > > > >
> > > > > > > <mx:List id="ls" dataProvider=
width="100%"
> > > > > > > <mx:itemRenderer>
> > > > > > > <mx:Component>
> > > > > > > <mx:VBox>
> > > > > > > <mx:Image width="100"
height="100"
> > > > > > > <mx:Button label="Remove"
click="dispatchEven
> > > > Event('removeMeal'
> > > > > > true))"/>
> > > > > > > <mx:Label text="{data.
> > > > > > > </mx:VBox>
> > > > > > > </mx:Component>
> > > > > > > </mx:itemRenderer>
> > > > > > > </mx:List>
> > > > > > > </mx:VBox>
> > > > > > >
> > > > > > > <mx:VBox width="100%" height="100%
> > > > > > >
> > > > > > > <!--mx:Label text="Please select ONE
ITEM from list
below"/-->
> > > > > > > <mx:ViewStack width="40%"
height="410" borderStyle=
> > > > > > borderThickness=
> > > > > > >
> > > > > > > <mx:VBox >
> > > > > > > <nutrition:Panelcre
> > > > > > meal="{nutritionDat
> > > > > > > </mx:VBox>
> > > > > > >
> > > > > > > <mx:VBox >
> > > > > > > <nutrition:Panelcre
> > > > > > meal="{nutritionDat
> > > > > > > </mx:VBox>
> > > > > > >
> > > > > > > <mx:VBox >
> > > > > > > <nutrition:Panelcre
> > > > > > meal="{nutritionDat
> > > > > > > </mx:VBox>
> > > > > > >
> > > > > > > </mx:ViewStack>
> > > > > > > <mx:HBox>
> > > > > > > <mx:Button label="Save"
click="vsMain.
0;"/>
> > > > > > > <mx:Button label="Cancel"
click="vsMain.
0;"/>
> > > > > > > </mx:HBox>
> > > > > > >
> > > > > > > </mx:VBox>
> > > > > > >
> > > > > > >
> > > > > > > </mx:HBox>
> > > > > > >
> > > > > > > </mx:ViewStack>
> > > > > > >
> > > > > > > </mx:Application>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > <?xml version="1.0"
encoding="utf-
> > > > > > > <mx:Panel xmlns:mx="http://www.adobe.
> > width="100%"
> > > > > > height="390"
> > > > > > > borderThicknessLeft
> > > > > > borderThicknessBott
> > > > > > > dropShadowEnabled=
> > > > > > > horizontalAlign=
> > > > > > xmlns:containers=
An
> > Item
> > > > > > from below">
> > > > > > >
> > > > > > > <mx:Script>
> > > > > > > <![CDATA[
> > > > > > > //import com.createmealPanel
> > > > > > >
> > > > > > > [Bindable]
> > > > > > > private var _meal:XMLList;
> > > > > > >
> > > > > > > public function set meal(value:XMLList)
> > > > > > > {
> > > > > > > if(value)
> > > > > > > {
> > > > > > > _meal = value;
> > > > > > > createContainers(
> > > > > > > }
> > > > > > > }
> > > > > > >
> > > > > > > private function createContainers(
> > > > > > > {
> > > > > > > for each(var item:Object in _meal.itemdata)
> > > > > > > {
> > > > > > > if(item.available == "yes")
> > > > > > > {
> > > > > > > var mealitem:Panelcreat
Panelcreatemealitem
> > > > > > > coverflow.addChild(
> > > > > > > mealitem.mealDetail
> > > > > > > }
> > > > > > > }
> > > > > > > }
> > > > > > > ]]>
> > > > > > > </mx:Script>
> > > > > > >
> > > > > > > <containers:
> > > > > > height="100%
> > > > > > > horizontalGap=
> > backgroundColor=
> > > > > > > segments="9" reflectionEnabled=
> > > > > > >
> > > > > > > <mx:HBox>
> > > > > > > <mx:Button label="item 1"
> > > > > > click="parentApplic
> > > > > > > <mx:Button label="side item 1"
> > > > > > click="parentApplic
> > > > > > > <mx:Button label="side item 2"
> > > > > > click="parentApplic
> > > > > > > </mx:HBox>
> > > > > > > </mx:Panel>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > <?xml version="1.0"
encoding="utf-
> > > > > > > <mx:Panel xmlns:mx="http://www.adobe.
> > width="310"
> > > > > > height="320"
> > > > > > > title="{mealDetails
> > > > > > >
> > > > > > >
> > > > > > > <mx:Metadata>
> > > > > > > [Event(name=
> > > > > > > [Event(name=
> > > > > > > </mx:Metadata>
> > > > > > >
> > > > > > > <mx:Script>
> > > > > > > <![CDATA[
> > > > > > > import mx.controls.
> > > > > > >
> > > > > > > [Bindable]
> > > > > > > public var mealDetails:
> > > > > > >
> > > > > > >
> > > > > > > private function calldispatch(
> > > > > > > parentApplication.
mealDetails.
> > > > > > > dispatchEvent(
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > > > ]]>
> > > > > > > </mx:Script>
> > > > > > >
> > > > > > > <mx:Image source="{'/uploads/
> > mealDetails.
> > > > }"
> > > > > > width="285" height="159"
> > > > > > >
> > > > > > > <mx:Label text="{mealDetails.
> > > > > > >
> > > > > > > <mx:Button label="Add to Meal"
click="dispatchEven
> > > > > > Event('addToMeal'
> > > > > > >
> > > > > > > <mx:Button label="Learn About
This"
click="calldispatch
> > > > > > >
> > > > > > > </mx:Panel>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --- In flexcoders@yahoogro
wrote:
> > > > > > > >
> > > > > > > > It seems like wherever this code is -
> > > > > > > >
> > > > > > > > [Bindable]
> > > > > > > > private var customMeals:
> > ArrayCollection;
> > > > > > > >
> > > > > > > > //throws error on this line
> > > > > > > > customMeals.
mealitem).mealDetai
> > > > > > > >
> > > > > > > > event.target is actually the panel
containing the
'create
> > meal
> > > > item'
> > > > > > > > button, as opposed to the mealitem
itself. Can you post
some
> > > > more of
> > > > > > > > the script and MXML for that part?
> > > > > > > >
> > > > > > > > The src folder is empty for me too in
the ZIP file.
> > > > > > > >
> > > > > > > > 2009/7/2 Jason B nospam@:
> > > > > > > > > yes heres the results
> > > > > > > > >
> > > > > >
> > > >
> >
"Main0.vsMain.