drummer_scum
09-01-2008, 12:52 AM
Hi guys, i have 2 swf files, Loader.swf & Shell.swf. They both have a document class each...
Loader.swf's document class "PreLoader"
package com.KB
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
public class PreLoader extends MovieClip
{
public var TEST_TEXT:String;
private var SWF_LOADER:Loader;
private var SWF_PATH:URLRequest;
public function PreLoader()
{
TEST_TEXT = "hello there";
SWF_PATH = new URLRequest("Shell.swf");
SWF_LOADER = new Loader();
SWF_LOADER.contentLoaderInfo.addEventListener(Even t.COMPLETE,LOAD_COMPLETE);
SWF_LOADER.load(SWF_PATH);
}
private function LOAD_COMPLETE(e:Event):void
{
trace("load complete");
addChild(SWF_LOADER);
}
}
}
and here's Shell.swf's document class "Shell"
package com.KB
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
public class Shell extends MovieClip
{
public function Shell()
{
test();
}
public function test():void
{
try
{
trace(PreLoader(this.parent.parent).TEST_TEXT);
}
catch(err:Error)
{
trace("there was an error");
}
}
}
}
the whole idea is PreLoader loads shell.swf and adds it to the stage and i want to be able to refer a variable or call a function from shell.swf document class to the PreLoader document class. Its easy to do this in a keyframe on the main timeline but using a document class is a little different, help please!
Loader.swf's document class "PreLoader"
package com.KB
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
public class PreLoader extends MovieClip
{
public var TEST_TEXT:String;
private var SWF_LOADER:Loader;
private var SWF_PATH:URLRequest;
public function PreLoader()
{
TEST_TEXT = "hello there";
SWF_PATH = new URLRequest("Shell.swf");
SWF_LOADER = new Loader();
SWF_LOADER.contentLoaderInfo.addEventListener(Even t.COMPLETE,LOAD_COMPLETE);
SWF_LOADER.load(SWF_PATH);
}
private function LOAD_COMPLETE(e:Event):void
{
trace("load complete");
addChild(SWF_LOADER);
}
}
}
and here's Shell.swf's document class "Shell"
package com.KB
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
public class Shell extends MovieClip
{
public function Shell()
{
test();
}
public function test():void
{
try
{
trace(PreLoader(this.parent.parent).TEST_TEXT);
}
catch(err:Error)
{
trace("there was an error");
}
}
}
}
the whole idea is PreLoader loads shell.swf and adds it to the stage and i want to be able to refer a variable or call a function from shell.swf document class to the PreLoader document class. Its easy to do this in a keyframe on the main timeline but using a document class is a little different, help please!