Hi!
I cant access to var in parent movie from class in child.
I have two swf’s: parent.swf and child.swf. In parent.swf in frame 6 is:
stop();
[COLOR=Red]var TestVar:String = "hello!";[/COLOR]
var imageRequest:URLRequest = new URLRequest("child.swf");
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(imageLoader);
in child.swf is external class called mainClass.as:
package
{
import flash.events.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
public class mainClass extends MovieClip
{
private var numSlides:int;
private var selectedThumb:MovieClip;
//and many vars
public function mainClass(){
transitionTime = 0.5;
//some other wars
position();
loadXml();
//some functions
[COLOR=Red] trace(MovieClip(parent.parent).TestVar);[/COLOR] // <--this isn't working - error :null object
return;
}// end function
I was trying use parent, parent.parent, parent.parent.parent etc. and any result - null object error.
How can I fix this?