I believe that you need to import the valueObjects.ShoppingCartItem component again from within your <Component> tags.
Do it within the VBox... ... <mx:Component> <mx:VBox> <mx:Script> <![CDATA[ import valueObjects.ShoppingCartItem ]]> </mx:Script> <mx:Button label="Remove" click="outerDocument.removeItem(valueObjects.ShoppingCartItem(data));" /> </mx:VBox> </mx:Component> ..etc I'm reasonably sure that this has to do with using the outer document as a reference.. the immediate component can't see what the outer document sees (the import). --- In flexcoders@yahoogroups.com, "oim415" <[EMAIL PROTECTED]> wrote: > > Hello, > > I am new to Flex and am currently in the process of going through the > Adobe Flex 2 Training from the Source book. Well everything was going > along fine until lesson 11. I have been fighting with a compiler error > 1120: Access of undefined property valueObjects. I have the correct > import statements and have double-checked my code multiple times with > that provided by the authors. I get the same error when I use the > author's code. Could there be a configuration problem in my enviroment. > up to this point, erverything compiles and runs as expected. The error > occurs on the click event of the button. Please review the code below. > I can provide further details once the questions start. thanks in > advance. > > <?xml version="1.0" encoding="utf-8"?> > <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"> > <mx:Metadata> > [Event(name="productRemoved",type="events.ProductEvent")] > </mx:Metadata> > > <mx:Script> > <![CDATA[ > import events.ProductEvent; > import valueObjects.ShoppingCart; > import valueObjects.ShoppingCartItem; > import valueObjects.Product; > import mx.controls.dataGridClasses.DataGridColumn; > > [Bindable] > public var cart:ShoppingCart; > > private function > renderPriceLabel(item:ShoppingCartItem,dataField:DataGridColumn):String{ > return "$"+String(item.subtotal); > } > > public function removeItem(cartItem:ShoppingCartItem):void{ > var prod:Product = cartItem.product; > var e:ProductEvent = new > ProductEvent(prod,"productRemoved"); > this.dispatchEvent(e); > } > > ]]> > </mx:Script> > > <mx:DataGrid > id="cartView" > dataProvider="{cart.aItems}" width="100%" height="100%" > editable="true" draggableColumns="false" > variableRowHeight="true"> > <mx:columns> > <mx:DataGridColumn dataField="product" headerText="Product" > itemRenderer="renderer.ecomm.ProductName" > editable="false"/> > <mx:DataGridColumn dataField="quantity" > itemEditor="mx.controls.NumericStepper" > editorDataField="value" editable="true" > headerText="Quantity" /> > <mx:DataGridColumn dataField="subtotal" headerText="Amount" > labelFunction="renderPriceLabel" editable="false" /> > <mx:DataGridColumn editable="false"> > <mx:itemRenderer> > <mx:Component> > <mx:VBox> > <mx:Button > label="Remove" > > click="outerDocument.removeItem(valueObjects.ShoppingCartItem(data))"/> > </mx:VBox> > </mx:Component> > </mx:itemRenderer> > </mx:DataGridColumn> > </mx:columns> > </mx:DataGrid> > > </mx:VBox> >