I have a home.fla file
``import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import flash.display.MovieClip;
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
SearchBut.addEventListener(MouseEvent.CLICK, clickSearch);
TestBut.addEventListener(MouseEvent.CLICK, clickTest);
//DemoBut.addEventListener(MouseEvent.CLICK, clickDemo);
var MC:MovieClip;
MC=new MovieClip();
var myGlobal:Number = 100;
this.addChild(MC);
var flag:Boolean;
flag=false;
//this.addEventListener(Event.ADDED,onFileAdded);
//
//function onFileAdded() {
//
//}
MC.addEventListener(Event.ADDED,MCAdded);
this.addEventListener(Event.ADDED,onFileAdded1);
function MCAdded(e:Event):void {
var f:Boolean;
f=true;
}
function onFileAdded1(e:Event):void {
flag=true;
trace("flag ");
trace(flag);
trace("This");
trace(this);
trace("This currentFrame");
trace(this.currentFrame);
}
function clickSearch(e:MouseEvent):void {
//var request:URLRequest = new URLRequest("Untitled21.swf");
var request:URLRequest = new URLRequest("Search.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
}
function clickTest(e:MouseEvent):void {
trace("In Test");
var request1:URLRequest = new URLRequest("test11.swf");
var loader1:Loader = new Loader()
loader1.load(request1);
addChild(loader1);
}
var acArray:Array;
var myXML:XML;
var leng:Number;
var myLoader:URLLoader = new URLLoader();
var len:Number;
var n:Number;
var tempArray:Array;
var wordBank:Array = [];
var display;
and another test11.fla
import flash.net.LocalConnection;
//import flash.filesystem.File;
//import flash.filesystem.FileStream;
//import flash.filesystem.FileMode;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.events.*;
var global:MovieClip = MovieClip(root);
var fileName:String;
var myTextLoader:URLLoader = new URLLoader();
var conn:LocalConnection;
var searchFlag:Boolean;
searchFlag=false;
var homeFlag:Boolean;
homeFlag=false;
//trace(File.applicationStorageDirectory.nativePath);
this.addEventListener(Event.ADDED,onFileAdded);
this.addEventListener(Event.COMPLETE,onFileAdded1);
function onFileAdded(e:Event):void {
trace("Movie clip root");
trace(MovieClip(root).flag);
trace("Movie clip MC");
trace(global.myGlobal);
//trace(MovieClip(MC).flag);
}
function onFileAdded1(e:Event):void {
trace("Movie clip root");
trace(MovieClip(root).flag);
}
//conn = new LocalConnection();
//conn.client = this;
//conn.allowDomain("*");
//Security.allowDomain("*");
BackBut.addEventListener(MouseEvent.CLICK, backButListener );
//conn.connect('SearchConnection');
//public var value:String = "This is the Test";
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
//fileName = File.applicationStorageDirectory.nativePath+"\\"+"myText.txt";
//myTextLoader.load(new URLRequest("File.applicationStorageDirectory.nativePathmyText.txt"));
//myTextLoader.load(new URLRequest(fileName));
function onLoaded(e:Event):void {
var myArrayOfLines:Array = e.target.data.split(" ");
for (var i = 0; i<myArrayOfLines.length; i++) {
var tempWord:String = myArrayOfLines[i];
if (Boolean(tempWord == "Search")) {
searchFlag=true;
} else
if (Boolean(tempWord == "home")) {
homeFlag =true;
}
}
}
function searchMethod():void
{
SearchBut.visible= true;
Label1.text="Search";
}
function backButListener(e:MouseEvent):void {
if(searchFlag==true)
{
var request:URLRequest = new URLRequest("Search.swf");
var loader:Loader = new Loader()
loader.x=0;
loader.y=0;
loader.load(request);
addChild(loader);
}
else
if(homeFlag==true)
{
var request1:URLRequest = new URLRequest("home.swf");
var loader1:Loader = new Loader()
loader1.x=0;
loader1.y=0;
loader1.load(request1);
addChild(loader1);
}
}
function searchListener(e:MouseEvent):void {
//var request:URLRequest = new URLRequest("Untitled21.swf");
// var loader:Loader = new Loader()
// loader.x=0;
// loader.y=0;
// loader.load(request);
// addChild(loader);
}
I want to access "myGlobal" from test11.fla