|
|
Home /
Groups /
Adobe Flex
Fw: Not Subscribed: Adobe Flex
Hi everyone,john 11/23/08 11:47 A john@thebarj.com wrote:Jeffry Houser 11/23/08 04:38 P Hi everyone, I'm pretty new to flex and have run into a problem that I could use some help with. I have a TabNavigator in my app the I create tabs for dynamically based on data. For each tab I create I add a child object that is a HList inside of a HBox. That child object dispatches a custom event that I want to catch in the main application. So my questions are, Do I add the event listener to the tab object or the child? Here is a code snippet. I hope it comes through ok cause this is my first post. (It's the ProductViewer that dispatches the event and I'm not sure about the event type either) I know the event is being sent, but not received. private function addTab(catgNm:String,dsCategory:ArrayCollection):void { var tb:HBox = new HBox(); tb.label=catgNm; tb.horizontalScrollPolicy="off"; var pv:ProductViewer = new ProductViewer(); pv.flowerCollection=dsCategory; pv.width= this.mainBox.width*.97 pv.addEventListener('events.ShoppingCartItemEvent',addCartItem); tb.addChild(pv); tn.addChild(tb); } Here is the event being dispatched. [Event(name="itemAdded",type="events.ShoppingCartItemEvent")] Any help would be greatly appreciated. John john@thebarj.com wrote: ----- Excess quoted text cut - see Original Post for more ----- If the event bubbles, either one would work. If not, add it to the HList. Based on your code, I do not think you need to enclose your ProductViewer in the HBox. Additionally, your listener looks wrong. Something like this should work fine: private function addTab(catgNm:String,dsCategory:ArrayCollection):void { var pv:ProductViewer = new ProductViewer(); pv.label=catgNm; pv.flowerCollection=dsCategory; pv.width= this.mainBox.width*.97 pv.addEventListener('itemAdded',addCartItem); // or possibly this: // pv.addEventListener(events.ShoppingCartItemEvent,addCartItem); // assuming that events is an object and ShoppingCartItemEvent is a constant on the events object named 'itemAdded' tn.addChild(tb); } ----- Excess quoted text cut - see Original Post for more ----- -- Jeffry Houser Technical Entrepreneur, Podcaster AIM: Reboog711 | Phone: 1-203-379-0773 -- Adobe Community Expert <http://tinyurl.com/684b5h> My Company: <http://www.dot-com-it.com> My Podcast: <http://www.theflexshow.com> My Blog: <http://www.jeffryhouser.com> -- Sent From a Mine Shaft
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||