Announcement Announcement Module
Collapse
No announcement yet.
Problem with 2 swfs loading two different application-config.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with 2 swfs loading two different application-config.xml

    Hi!

    I have an swf (S1) called inside another swf (S2). Both are loading two different application-context files. S1 succesfully loads all objects, S2 receive the "A class with the name 'className' could not be found." error. When S2 is executed on its own, context is loaded succesfully. It seems S1's context is overriding S2's context. Is there any way I can avoid it to happen?

    Thanks a lot for your help!

  • #2
    Are both swf's creating their own ApplicationContext? If so, I don't think this should cause problems, although I'm not entirely sure about that.

    It might be that the swf is loaded in another application domain and so if the context looks up definitions (and hence classes), it looks them up in the wrong app domain.

    Is it possible to provide some sample code that illustrates the error?

    regards,
    Christophe

    Comment


    • #3
      Hi Christophe!

      Both swf are creating their own ApplicationContext.

      Before loading S2, S1 loads the ApplicationContext this way:

      Code:
      var APPLICATION_CONTEXT:String = "http://localhost:49660/applicationContext.xml";
      import org.springextensions.actionscript.context.support.XMLApplicationContext;
      
      var xmlAppContext:XMLApplicationContext;
      xmlAppContext = new XMLApplicationContext(APPLICATION_CONTEXT);
      xmlAppContext.addEventListener(Event.COMPLETE, onContextLoaded);
      xmlAppContext.load();
      
      import com.hola_riviera_maya_elearning.Aplicacion;
      var appDetails:Aplicacion;
      
      function onContextLoaded(e:Event):void {
      	appDetails = xmlAppContext.getObject("aplicacion");
      	trace("Load S1's context");
      	play();
      }
      S2 loads his ApplicationContext in the same way:

      Code:
      var APPLICATION_CONTEXT:String = "http://localhost:49660/examen.xml";
      
      import org.springextensions.actionscript.context.support.XMLApplicationContext;
      
      var xmlAppContext:XMLApplicationContext;
      xmlAppContext = new XMLApplicationContext(APPLICATION_CONTEXT);
      xmlAppContext.addEventListener(Event.COMPLETE, onContextLoaded);
      xmlAppContext.load();
      	
      import com.hola_riviera_maya_elearning.Examen;
      var exam:Examen;
      
      function onContextLoaded(e:Event):void {
      	exam = xmlAppContext.getObject("examen");
      	trace("Load S2's context");
      }
      The error returned can be seen in here.

      All files and classes are available here (you will need flash cs3 or higher).

      Thanks a lot for your help!

      Comment

      Working...
      X