• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reusability - Components - Events

 
Ranch Hand
Posts: 167
Netbeans IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a screen I have working with everything in one file. See attached image.

The screen consists of two HGroups Lets say HGroup Top and Hgroup Bottom

Inside HGroup Top, I have three panels lets say Panel Main, Panel 2 and Panel 3.

Panel Main contains a Tree and the remainder panels have datagrids

Inside Hgroup Botton, I have two panels. Lets say second Main, and Panel 4 and all these panels contain datagrids

When a selection is made in the Main Panel, the change event is triggered and it updates the lists for Panels 2 and 3 and the second main panel

When a selection is made in the second main panel, then Panel 4 list is updated.

So now I want to move each of the panels into their own Component MXML file for re-usability. I was able to move Panel 4 easily, passing in the list required

However, when I tried to move the Second Main Panel into its own component file, I couldnt figure out how to trigger the change event to pass the data into the Panel 4s file.

So I ended up moving the the parent Panel 4s logic into the Second Mains file making Panel 4 a part of the Second Mains file and that solved the issue for Panel 4 except now Panel 4 is a part of the Second Main and is not separated.

So, is there a way for me to keep Panel 4 separate from the Second Main file and yet affect change to Panel 4 in the parent Application?

Of course, I am wishing to do the same for the Main Panel and Panels 2 and 3 as well.

sixth.PNG
[Thumbnail for sixth.PNG]
Screen shot
 
Michelle Nicholes
Ranch Hand
Posts: 167
Netbeans IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found the answer.

Watch the Flex in Week Video on Day 3 the first video.

Flex in a Week Day 3.01

First you create your component which contains the action then below the Group or Panel or whatever your components base is enter



Then in that Event in your action class you register the event and then dispatch it



Then in your parent Application, in your component you assign an event handler for the someeventname and then in that event handler, you do the action on whatever sub component you wish.

In my example, I would do the first two steps in my Main Panel, and in my second Main panel and the actions would affect the remaining Panels which are affected by that event.
reply
    Bookmark Topic Watch Topic
  • New Topic