10 Replies Latest reply on Nov 12, 2006 2:20 PM by CaptnRickits

    Different behaviour in local and remote clips

    CaptnRickits
      I'm in the process of writing a flash framework that is used to load other swfs in as 'applications'. The framework provides a simple API by attaching some functions to the _root, so that loaded applications may call them using _root.whatever(...).

      This is all working beautifully.. except for one thing:

      I want to allow loaded applications access to per-application named singletons. This works perfects when run locally.

      BUT: When uploaded and run in a browser the singleton objects retuned by the functions in 1.swf are always undefined!

      I know, through debug statements and a debug output window, that when running remotely the singleton object is definatley created only once, and subsequent requests for it return the created object.

      Here's what happens.
      the main framework, 1.swf is loaded
      This in turn loads (say) app.swf
      app.swf contains two movieclips, both of which call
      _root.getSingleton(this,"globals");
      Where the function getSingleton has been placed onto _root by 1.swf when it loads.
      However, although the debug output for the function getSingleton shows it's returning an object, by the time it gets back into the clips in app.swf, the object has become undefined!

      I have seen this sort of behaviour before. Return values from functions sometimes just going missing in transit and becoming undefined. Does anybody have any ideas? I don't think that it can be a security issue, since all the swfs are loaded from the same server.