0

I have 2 SWFs. One Parent.swf and other is child.swf.

in the parent SWF I am loading child swf.

I am using a loader to load swf. My code is as follows :

----------------------------------------
    stop();
var req:URLRequest = new URLRequest("stalla.swf");

var _loader = new Loader();
var stallaloader1:MovieClip=new MovieClip();
addChild(stallaloader1);

  Object(this).stallaloader1.x=5000;
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
_loader.load( req ); 
stallaloader1.addChild(_loader);
trace(stallaloader1.x);
//_loader.vipin="Ashwini n Meha";
function loader_complete(evt:Event):void {
//addChild(_loader);
var _loader:MovieClip = MovieClip(evt.target.content);
    //addChild(_loader); //embedSWF
    //stallaloader1.stallclick;
    //_loader.stallclick;

    //evt.currentTarget.x=1000;

    // btn2.addEventListener(MouseEvent.CLICK,_loader.stallclick);
     btn2.addEventListener(MouseEvent.CLICK, function() {videovariables(2)});

}
function videovariables(vid):void {
trace(_loader.vipin);
    _loader.vipin="Overwrite with Ashwini"
     trace(_loader.vipin);
 }

These 3 line work well if called in loader_complete, BUT

If we put them in videovariables function, we get error :

ReferenceError: Error #1069: Property vipin not found on flash.display.Loader and there is no default value. at _3dstalls_fla::Symbol1_1/videovariables()[_3dstalls_fla.Symbol1_1::frame1:53] at Function/()[_3dstalls_fla.Symbol1_1::frame1:49]

What may be the reason? Please let me know.

Thanks

1 Answer 1

2

If you look at the error message it says : Property vipin not found on flash.display.Loader meaning that _loader refers to the Loader instance, not to the MovieClip.

As the MovieClip you want is loaded in the loader (_loader), you can access it with content property of the Loader class.

function videovariables(vid):void {
     trace(_loader.content.vipin);
    _loader.content.vipin="Overwrite with Ashwini"
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.