tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/602-modular-utility-causing-error-1065-variable-footerview-is-not-definedRobotlegs: Discussion 2018-10-18T16:35:29Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:23:16Z2011-07-12T10:23:16ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>Mediator mappings in the module:</p>
<pre>
<code> mediatorMap.mapView( BackgroundView, BackgroundViewMediator, BackgroundView);
mediatorMap.mapView( HeaderView, HeaderViewMediator, HeaderView );
mediatorMap.mapView( FooterView, FooterViewMediator, FooterView );</code>
</pre>
<p>Looks like its tries to get a definition of the class in the
wrong application domain. My SWF gets loaded with the following
LoaderContext:</p>
<pre>
<code> new LoaderContext(true, new ApplicationDomain(ApplicationDomain.currentDomain), SecurityDomain.currentDomain)</code>
</pre></div>Weyerttag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:29:15Z2011-07-12T10:29:15ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>OK, with out digging deep at all, I notice you state:</p>
<p>"I have created parentInjector property in the document class
which then initiates my context derived from the ModuleContext
class."</p>
<p>(I'm assuming youj are using Joels modular util) The IModule
specifies:<br>
function set parentInjector(value:IInjector):void;</p>
<p>so the ModuleContext should be creating the child Injector for
you??</p>
<p>can you paste some code?<br>
or if you can't can you paste me some in chat?</p></div>neiltag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:30:17Z2011-07-12T10:30:17ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>Isn't there an ApplicationDomain prop that you can set?</p></div>neiltag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:32:01Z2011-07-12T10:32:01ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>yep, you can pass in an ap domain in the create child<br>
injector.createChild(_applicationDomain)</p></div>neiltag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:34:55Z2011-07-12T10:34:55ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>ok, the Application view is retrieved from the contextView<br>
so the question, what view do you supply to your ModuleConext?</p></div>neiltag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:36:00Z2011-07-12T10:36:00ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>My code is the following (ISequenceItemView introduces the
dispose method):</p>
<pre>
<code>/**
* Application Entry Class
*/
public class my_module extends Sprite implements ISequenceItemView {
protected var context: DrawingModuleContext;
[Inject]
public function set parentInjector(value:IInjector):void
{
trace("DrawingModule.parentInjector(): value=" + value);
context = new MyModuleContext( this, true, value );
}
/**
* Constructor
*/
public function my_module() {
super();
}
/**
* @inheritDoc
*/
public function dispose():void
{
if ( context )
{
context.shutdown();
}
trace("DrawingModule.dispose()");
}</code>
</pre>
<p>}</p></div>Weyerttag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:47:04Z2011-07-12T10:47:04ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>I changed my code with the following code snippet:</p>
<pre>
<code> [Inject]
public function set parentInjector(value:IInjector):void
{
trace("DrawingModule.parentInjector() 1: value=" + value);
trace("DrawingModule.applicationDomain 2: " + this.loaderInfo.applicationDomain );
trace("DrawingModule.applicationDomain 3: " + this.loaderInfo.applicationDomain.getDefinition('ch.nothing.swisslos.subito.modules.drawing.views.elements.BackgroundView') );
context = new DrawingModuleContext( this, true, value );
}</code>
</pre>
<p>and then it correctly creates an instance:</p>
<pre>
<code> DrawingModule.parentInjector() 1: value=[object SwiftSuspendersInjector]
DrawingModule.applicationDomain 2: [object ApplicationDomain]
DrawingModule.applicationDomain 3: [class BackgroundView]
DrawingModuleContext.construct()</code>
</pre>
<p>I am not sure what I am doing wrong. The error happens in the
following line of code:</p>
<pre>
<code> //
var topLayer: Sprite = new Sprite();
topLayer.name = "top";
var contentLayer: Sprite = new Sprite();
contentLayer.name = "content";
var bottomLayer: Sprite = new Sprite();
bottomLayer.name = "bottom";
topLayer.addChild( new FooterView() );
topLayer.addChild( new HeaderView() );
bottomLayer.addChild( new BackgroundView() );
contextView.addChild( bottomLayer );
contextView.addChild( contentLayer );
contextView.addChild( topLayer );</code>
</pre></div>Weyerttag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T10:51:27Z2011-07-12T10:51:27ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><blockquote>
<p>ok, the Application view is retrieved from the contextView so
the question, what view do you supply to your ModuleConext?</p>
</blockquote>
<p>I am supplying the document class to the module context.</p></div>Weyerttag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T11:10:21Z2011-07-12T11:21:05ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>ok, I think we can assume that this is an ApplicationDomain
problem.<br>
What we need to determine is if this has anything to do with RL or
SS or neither.<br>
Does the error get thrown when a new FooterView is created? or when
RL and SS try and automatically mediate it?</p>
<p>ie<br>
var footer:FooterView = new FooterView()<br>
topLayer.addChild( footer );</p>
<p>where does it chuck that error?</p></div>neiltag:robotlegs.tenderapp.com,2009-10-18:Comment/85540652011-07-12T11:25:34Z2011-07-12T11:25:34ZModular Utility causing Error #1065: Variable FooterView is not defined.<div><p>Yes, I don't have the problem when I kickstart the module
without loading into the shell or when I disable the mediator
mappings. The code for loading a module is the following:</p>
<pre>
<code> _contentURL = contentURL;
var context: LoaderContext = new LoaderContext();
context.checkPolicyFile = true;
context.applicationDomain = new ApplicationDomain( ApplicationDomain.currentDomain );</code>
</pre>
<p>public function load(contentURL: String):void<br>
{</p>
<pre>
<code> trace("ModuleSequenceItemView.load(): contentURL=" + _contentURL );
_movieLoader = new Loader();
_movieLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onContentLoaded);
_movieLoader.load( new URLRequest( contentURL ), context );</code>
</pre>
<p>}</p>
<pre>
<code>/**
* @inheritDoc
*/
protected function onContentLoaded(event: Event):void
{
var module: ISequenceItemView = _movieLoader.content as ISequenceItemView;
_moduleView = _movieLoader.content as Sprite;
// inject into the module class so that parentInjector gets called
if ( injector ) injector.injectInto( _moduleView );
if ( module ) {
module.setSequenceItem( _sequenceItem );
module.load( _contentURL );
} else {
trace("MODULE MISSING ISequenceItemView module implementation");
}
this.addChild( _movieLoader.content );
}</code>
</pre>
<p>I am not sure what I am doing wrong. The only thing that
probably is different that I don't map all the modules which is
problematic because I don't know which modules will exist in the
future.</p></div>Weyert