Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
December 12, 2017, 04:40:13 PM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: How to share module's components with other modules?  (Read 2779 times)
zwierz
Newbie
*
Posts: 1


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

Hi,

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.
Logged
Pages: [1]
Print
Jump to: