Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Author Topic: How to share module's components with other modules?  (Read 9742 times)
Posts: 1

View Profile Email
« on: August 11, 2010, 12:40:22 »


I'm writing a modular application that uses PV3D library (3D engine). I'd like to have PV3D classes created in a separate module but I'll need to share some of the PV3D objects from that module with other modules.

It's my first modular application and I'm still looking for good practices. My question is how should I share PV3D objects from one module with other modules?

For now I see two approaches:

1. Load PV3D module before any other module and pass reference to it to all futher modules. I could write a class that will extend FlexModule class with some setPV3DModuleReference(...) method and create all other modules with that class as a base.

2. When PV3D module is loaded I could send a notification with a reference to module as the notification's body and respond to such notification in every module that needs PV3D's objects.

I decided that second approach is simpler and because of that better. I tried to use it but unfortunately while sending notification with reference to some PV3D's object an argument error occures:

ArgumentError: Error #2084: The AMF encoding of the arguments cannot exceed 40K.

Despite the error the reference is passed (I can modify passed object).
I can event prevent error from appearing by putting sendNotifiaction method into try-catch statemet but I don't like such solution. Something definitely goes wrong and it seems that I have too less experience to find out what and to decide what would be best to do to solve this problem.

Thanks for any help.
Pages: [1]