Import for runtime sharing error
Hi all,
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.
3) "sceneB.swf" - contains in the stage "mc_B" (copied from "lib.swf"). This MovieClip is checked with "Import For Runtime Sharing" in the library.
4) "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: http://www.magistec.com.br/gustavo/Project.zip
Thanks
Gustavo Lima
