House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search flex

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  Adobe Flex

Fw: Not Subscribed: Adobe Flex

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Hi everyone,
john
11/23/08 11:47 A
john@thebarj.com wrote:
Jeffry Houser
11/23/08 04:38 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
john
11/23/2008 11:47 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jeffry Houser
11/23/2008 04:38 PM

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


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists