# Class Design problem

**URL:** <https://forum.kirupa.com/t/class-design-problem/304315>\
**Category:** flash\
**Created:** [February 5, 2010, 9:16am UTC](https://forum.kirupa.com/t/class-design-problem/304315 "2010-02-05T09:16:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stratboy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/stratboy/32/3054_2.png) [@Stratboy](https://forum.kirupa.com/u/Stratboy)\
**Post date:** [February 5, 2010, 9:16am UTC](https://forum.kirupa.com/t/class-design-problem/304315/1 "2010-02-05T09:16:59Z")

</div>

Hi!

The actors:

- Controller class: loads unloads pages (swf) of a website. Listens to transitionIn/Out custom events to manage the sequence loadnewpage-transIn-transOut, that can vary depending on the website, for example transOut-loadnewpage-transIn…

- A custom PageEvent class. I can pass a e.page property when broadcasting a PageEvent, so the listener always knows which page has just done the transition.

- Some PageFx classes. Every page share the same methods (say page.transIn(), page.transOut()) that mask use of different PageFx classes, so I can use different transitions for different pages, if I want.  
The PageFx classes broadcast PageEvents.

- The Pages document classes. They could broadCast PageEvent too, based on listening to PageFx classes.

The problem:

I don’t want Controller to subscribe/unsubscribe to PageEvent for every page it loads/unloads. ex. newPage.addEventListener(PageEvent.TRANS\_OUT\_COMPLETE,f)…

I’d like the Controller to subscribe only 1 time to one single broadcaster (a singleton?), that notifies the controller every time a page transin or out.

How would you suggest to design this schema?

:doh:
