Announcement Announcement Module
Collapse
No announcement yet.
Prevent Stage autowiring on Modules Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    this.moduleFactory.info().currentDomain

    [QUOTE=666shooter;252362]
    You should still be able to get the module's applicationdomain through "myModule.loaderInfo.applicationDomain".
    [/code]

    well, that is exactly my frustration, if I do this inside the module:
    Code:
    var clsName:String = getQualifiedClassName(this);
    var b:Boolean = this.loaderInfo.applicationDomain.hasDefinition(clsName);
    Its comes up with 'false'. That's why I'm still stumped...
    I was able to get the module's applicationdomain by using this.moduleFactory.info().currentDomain. See the code below to test it out:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" creationComplete="init()">
    <mx:Script>
    	<![CDATA[
    		import flash.utils.getQualifiedClassName;
    		private function init():void
    		{
    			//doesn't work, as you've discovered
    			var clsName:String = getQualifiedClassName( this );
    			trace( this.loaderInfo.applicationDomain.hasDefinition(clsName ) );  
    			//traces false
    			
    			//works
    			var foo:ApplicationDomain = this.moduleFactory.info().currentDomain as ApplicationDomain;
    			trace( foo.hasDefinition(clsName ) ); 
    			//traces true
    		}
    	]]>
    </mx:Script>
    </mx:Module>
    If you debug and look at the moduleFactory.info() object, there's some interesting stuff in there.

    HTH,

    Tom

    Comment


    • #17
      a google search for moduleFactory.info shows that Adobe uses that approach in mx.effects.EffectManager which you can see here: http://bit.ly/nKums.

      Comment


      • #18
        thanks for the tip!

        Hi there,

        that code looks very interesting indeed, thanks for the heads up!

        Oh, one minor issue though, I will be on holiday for the coming three weeks. Perhaps I'll have some time this evening to look into this, but please don't be disappointed if I won't make it. In that case either someone else in the team may pick this up, and otherwise it'll be a while before I can look into this further.

        cheers,

        Roland

        Comment


        • #19
          SVN commit

          Ok, I used my lunchbreak to have a go at this. I think I have things working, the unit tests are giving me green bars at least.
          I haven't created any decent unit tests for the specific module functionality yet, but my little test app didn't give me any grave errors.
          If any of you can test this with your application then please do, the changes have been committed to the trunk.

          Thank you for all your help so far!

          cheers,

          Roland

          Comment


          • #20
            Roland, thanks so much for this fix. You guys are seriously champs.

            I'll give this a go as soon as possible. How do I compile the trunk into a SWC? There doesn't seem to be a build file in the trunk as there is in the tags.

            Comment


            • #21
              I'm still unfortunately not seeing any autowiring on Modules as far as I know, and I'm using the latest trunk. Nothing inside of a Module is autowired, at least when using metadata.

              Also, I can't even get an IObjectSelector working in my application context. I have defined this bean:
              Code:
              <object id="flexStageObjectSelector" class="com.beetlemed.webapp.spring.AutowireSelector"/>
              ... and I can see that it is instantiated, but it doesn't get used at all. In my approve block, I'm intentionally throwing an error, and nothing happens, no RTE is thrown. Is this bit of functionality broken in the current trunk?

              Comment


              • #22
                Ok, I think I have it working now
                I had to do some compiler stuff to include the metadata, even though it's being included automagically by my application SWF, it's not being included in modules, though they use the same config file... weird.

                However, the other problem is still present. SA won't recognize my IObjectSelector in my application context.

                Comment


                • #23
                  sometimes the bleeding edge bites you in the ass

                  Hey there,

                  I'm afraid using the trunk can sometimes be 'dangerous', I've just refactored quite a bit and the online documentation isn't valid anymore. (Mind you, it says version 0.8, so you can't blame me haha).
                  The stagewiring logic has been refactored into a seperate interface called IStageProcessor, which will allow other types of stage processing besides autowiring. (I've just committed a localization package yesterday which can assign resources to stage components, for instance).
                  The override has slightly changed for the autowiring at the moment, right now to override you'd need this markup:

                  Code:
                  <object id="flexStageObjectSelector" class="com.beetlemed.webapp.spring.AutowireSelector"/>
                  
                  <object id="flexStageObjectDefinitionResolver" class="org.springextensions.actionscript.ioc.wire.DefaultObjectDefinitionResolver"/>
                  
                  <object class="org.springextensions.actionscript.stage.DefaultAutowiringStageProcessor" id="defaultAutowiringStageProcessor">
                    <property name="selector" ref="flexStageObjectSelector"/>
                    <property name="objectDefinitionResolver" ref="flexStageObjectDefinitionResolver"/>
                  </object>
                  Mind you, this might remain subject to change

                  let me know if this works for you.


                  cheers,

                  Roland

                  Comment


                  • #24
                    Yeah, trust me, I know about the dangers of riding the bleeding edge, it is sharp after all, and covered in blood

                    But thanks for pointing me in the right direction, I'll give that code a shot and get back to you on how/if it works for me.

                    Comment

                    Working...
                    X