Results 1 to 3 of 3

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

  1. #1
    Join Date
    Jun 2009
    Location
    Mexico City
    Posts
    6

    Default 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. #2
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    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
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  3. #3
    Join Date
    Jun 2009
    Location
    Mexico City
    Posts
    6

    Default

    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •