ecreate / fabrication

Automatically exported from code.google.com/p/fabrication
0 stars 0 forks source link

0.7.5 not working in a pure as3 project #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I created a project in flashdevelop to test Fabrication, i used the 0.6 
version of the swc
2. When I try to switch the swc for the 0.7.5 version, i have run-time errors
3.

What is the expected output? What do you see instead?
I should be able to use Fabrication 0.7.5 but i get some run-time errors if i do

What version of the product are you using? On what operating system?
0.7.5

Please provide any additional information below.
Here is the output i get from flash player debug :
Error: A class with the name 
'com.hibernum.testfabrication.testmoduleb.view::TestModuleBMediator' could not 
be found.
    at org.as3commons::ClassUtils$/forName()[/Users/sema/Work/projects/personal/development/PureMVCFabricationIoC/as3-commons-reflect/org/as3commons/ClassUtils.as:83]
    at org.as3commons::ClassUtils$/forInstance()[/Users/sema/Work/projects/personal/development/PureMVCFabricationIoC/as3-commons-reflect/org/as3commons/ClassUtils.as:50]
    at org.as3commons.reflect::Type$/forInstance()[/Users/sema/Work/projects/personal/development/PureMVCFabricationIoC/as3-commons-reflect/org/as3commons/reflect/Type.as:77]
    at org.puremvc.as3.multicore.utilities.fabrication.injection::Injector/inject()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/injection/Injector.as:64]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator::FabricationMediator/performInjections()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/mediator/FabricationMediator.as:819]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator::FabricationMediator/onRegister()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/mediator/FabricationMediator.as:708]
    at com.hibernum.testfabrication.testmoduleb.view::TestModuleBMediator/onRegister()[D:\Production\hibernum\test_template_fabrication\src\com\hibernum\testfabrication\testmoduleb\view\TestModuleBMediator.as:28]
    at org.puremvc.as3.multicore.core::View/registerMediator()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3_MultiCore\src\org\puremvc\as3\multicore\core\View.as:205]
    at org.puremvc.as3.multicore.patterns.facade::Facade/registerMediator()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3_MultiCore\src\org\puremvc\as3\multicore\patterns\facade\Facade.as:227]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.facade::FabricationFacade/registerMediator()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/facade/FabricationFacade.as:431]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.command::SimpleFabricationCommand/registerMediator()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/command/SimpleFabricationCommand.as:171]
    at com.hibernum.testfabrication.testmoduleb.controller::TestModuleBStartupCommand/execute()[D:\Production\hibernum\test_template_fabrication\src\com\hibernum\testfabrication\testmoduleb\controller\TestModuleBStartupCommand.as:18]
    at org.puremvc.as3.multicore.utilities.fabrication.core::FabricationController/executeCommand()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/core/FabricationController.as:166]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at org.puremvc.as3.multicore.patterns.observer::Observer/notifyObserver()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3_MultiCore\src\org\puremvc\as3\multicore\patterns\observer\Observer.as:100]
    at org.puremvc.as3.multicore.core::View/notifyObservers()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3_MultiCore\src\org\puremvc\as3\multicore\core\View.as:127]
    at org.puremvc.as3.multicore.utilities.fabrication.core::FabricationView/notifyObservers()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/core/FabricationView.as:76]
    at org.puremvc.as3.multicore.patterns.facade::Facade/notifyObservers()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3_MultiCore\src\org\puremvc\as3\multicore\patterns\facade\Facade.as:294]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.facade::FabricationFacade/notifyObservers()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/facade/FabricationFacade.as:331]
    at org.puremvc.as3.multicore.patterns.facade::Facade/sendNotification()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3_MultiCore\src\org\puremvc\as3\multicore\patterns\facade\Facade.as:277]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.facade::FabricationFacade/sendNotification()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/facade/FabricationFacade.as:323]
    at org.puremvc.as3.multicore.utilities.fabrication.patterns.facade::FabricationFacade/startup()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/patterns/facade/FabricationFacade.as:230]
    at org.puremvc.as3.multicore.utilities.fabrication.components.fabricator::ApplicationFabricator/startApplication()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/components/fabricator/ApplicationFabricator.as:356]
    at org.puremvc.as3.multicore.utilities.fabrication.components.fabricator::ApplicationFabricator/initializeFabricator()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/components/fabricator/ApplicationFabricator.as:323]
    at org.puremvc.as3.multicore.utilities.fabrication.components.fabricator::ApplicationFabricator/readyEventListener()[/Users/sema/Work/projects/personal/fabrication/framework/src/org/puremvc/as3/multicore/utilities/fabrication/components/fabricator/ApplicationFabricator.as:365]
    at flash.display::DisplayObjectContainer/addChild()
    at com.hibernum.testfabrication.shell.view::TestFabricationMediator/onCompleteModuleB()[D:\Production\hibernum\test_template_fabrication\src\com\hibernum\testfabrication\shell\view\TestFabricationMediator.as:107]

Thanks in advance,
Arnaud

Original issue reported on code.google.com by arnaud.h...@gmail.com on 27 Sep 2010 at 8:59

GoogleCodeExporter commented 9 years ago
Hi Arnaud,

Can you send me some code example? You are using modules, as I see, so please 
make sure all your classes are accesible within module domain. Remember, that 
each module/main app has separate fabrication and you cannot acces one actor 
from moduleA within fabrication from moduleB.

Original comment by rafael.s...@gmail.com on 29 Sep 2010 at 8:16

GoogleCodeExporter commented 9 years ago
Here is the code I use for loading a module (inside my ShellMediator.as):
_loader = new Loader();
var req:URLRequest =  new URLRequest("FBAuth.swf")
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteModuleA)
_loader.load(req)

and here is the callback, after loading COMPLETE :
var content:FlashApplication = _loader.content as FlashApplication;
content.router = applicationRouter;
content.defaultRouteAddress = applicationAddress;
// app is the main viewcomponent of the shell mediator
app.addChild(content)

Im pretty sure it's related to an applicationDomain issue, and maybe the same 
as this bug : http://forums.puremvc.org/index.php?topic=1763.0
but as I dont use any flex module (or any flex at all) I cant find out where 
the problem comes from (see above comment for details about the runtime error)

But maybe theres a better way for loading a module (the loading code is taken 
from the flash-only example, which uses v.0.6 swc)
When i use "fabrication-0.6-flex.swc", everything works fine but when I switch 
for fabrication-0.7.5.5-as3.swc (or whatever other 0.7.* version), i get this 
error

I'm really willing to find (and kill!!!) this bug, so if you can put me in the 
right direction, that would be great

thanks,
Arnaud

Original comment by arnaud.h...@gmail.com on 29 Sep 2010 at 1:37

GoogleCodeExporter commented 9 years ago
bug closed, it was related to the use of bulkloader for loading modules

Original comment by arnaud.h...@gmail.com on 5 Nov 2010 at 7:52

GoogleCodeExporter commented 9 years ago
What do You mean by Your last comment? Probably I'll figure it out myself, but 
currently I'm struggling with the same problem. Is the loader bad for doing 
this? Do You mean BulkLoader should be used?

Original comment by broadysm...@gmail.com on 24 Nov 2010 at 5:11

GoogleCodeExporter commented 9 years ago
Oh my God... Because tutorial didn't explicitly say everything, i copy pasted 
your solution that didn't work and forgot about it... Then when it didnt work 
for me i came back here, but i didn't guess that the error is here:
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteModuleA)

should be
_loader.addEventListener(Event.COMPLETE, onCompleteModuleA)

I found that out only because the error changed from the one you mention to 
#1009 somehow...

Original comment by broadysm...@gmail.com on 24 Nov 2010 at 6:11

GoogleCodeExporter commented 9 years ago
Whoops, no, still having a problem. I'm struggling in FlashDevelop and will 
post some example code soon...

Original comment by broadysm...@gmail.com on 24 Nov 2010 at 8:08

GoogleCodeExporter commented 9 years ago
Sorry for spam, but I feel obligated to write a solution here. It's simple... 
And this time I tested it from beginning to the end, fabrication works and it's 
great!

Original code:

ldr = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadHandler);
var url:String = 'module.swf';
var urlReq:URLRequest = new URLRequest(url);

ldr.load(urlReq);

Change it to:

var ldrContext:LoaderContext = new LoaderContext(false, 
ApplicationDomain.currentDomain); //here...

ldr = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadHandler);
var url:String = 'module.swf';
var urlReq:URLRequest = new URLRequest(url);

ldr.load(urlReq, ldrContext); //...and here

That's everything!

Original comment by broadysm...@gmail.com on 24 Nov 2010 at 9:30