# Import for runtime sharing error

**URL:** <https://forum.kirupa.com/t/import-for-runtime-sharing-error/318034>\
**Category:** flash\
**Created:** [January 8, 2011, 7:47pm UTC](https://forum.kirupa.com/t/import-for-runtime-sharing-error/318034 "2011-01-08T19:47:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GustavoLima](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@GustavoLima](https://forum.kirupa.com/u/GustavoLima)\
**Post date:** [January 8, 2011, 7:47pm UTC](https://forum.kirupa.com/t/import-for-runtime-sharing-error/318034/1 "2011-01-08T19:47:32Z")

</div>

I have in my project 4 files listed below:

- lib.swf
- sceneA.swf
- sceneB.swf
- loader.swf

1. “lib.swf” - contains two MovieClips, “mc\_A” and “mc\_B” with “Export For Runtime Sharing” checked.

2. “sceneA.swf” - contains in the stage “mc\_A” (copied from “lib.swf”). This MovieClip is checked with

“Import For Runtime Sharing” in the library.

1. “sceneB.swf” - contains in the stage “mc\_B” (copied from “lib.swf”). This MovieClip is checked with

“Import For Runtime Sharing” in the library.

1. “loader.swf” - initially loads the “sceneA.swf” file. When the user click on the stage it loads

“sceneB.swf”. Its first frame contains the following code:

=================================  
import flash.events.MouseEvent;

var myLoader:Loader;

function loadScene(url:String)  
{  
myLoader = new Loader();  
myLoader.load(new URLRequest(url));  
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, on\_sceneLoaded);  
}

function on\_sceneLoaded(e:Event):void  
{   
myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, on\_sceneLoaded);  
addChild(myLoader);  
}

stage.addEventListener(MouseEvent.CLICK, on\_mouseClick);

function on\_mouseClick(e:MouseEvent)  
{  
removeChild(myLoader);  
myLoader.unload();  
myLoader = null;  
loadScene(“sceneB.swf”);  
}

# loadScene(“sceneA.swf”);

When I execute “loader.swf”, the first file “sceneA.swf” is loaded correctly… but when the user

clicks on the stage the following message is displayed:

“ReferenceError: Error #1065: Variable mc\_B is not defined.”

What is the problem with my code?  
The project files are here: www.magistec.com.br/gustavo/Project.zip

Regards  
Gustavo Lima
