4 Replies Latest reply on Sep 25, 2008 12:55 PM by Graeme_Smith

    SWFLoader load and unload

      I have a main Application which calls a Module....
      Then that module loads child applications.
      for example:

      <mx:State name="OrgState">
      <mx:AddChild relativeTo="{SWFContainer}" position="firstChild">
      <mx:SWFLoader id="OrgSWFLoader"
      width="100%" height="100%"
      source="Organization.swf" autoLoad="false"
      verticalAlign="top" horizontalAlign="center"/>
      <mx:SetProperty target="{DBPanel}" name="height" value="{dispAreaHt + 10}"/>
      <mx:SetProperty target="{DBCanvas}" name="height" value="{dispAreaHt + 10}"/>

      there's a dozen like this then within the action script, The user clicks on an image for the page they want to goto, for example:

      private function setupOrgsSubMenuClick():void

      Before the user selects the SWFLoader (eg. OrgSWFLoader = null). Then I load the SWF component like this:

      private function loadSWFComponent(newState:String):void
      if (Application.application.IsActiveSession() == false)


      currentState = newState;

      if(currentState == "OrgState")
      And the OrgSWFLoader has variables in it (all works as I want it so far). Then, at the moment, my unload looks like this:

      private function unloadPrevSWFFile():void
      if(currentState == "OrgState")
      OrgSWFLoader.source = "";

      but it does not make the OrgSWFLoader = null again.

      Any thoughts?
      Help is appreciated, thanks in advance.