views:

408

answers:

1

Hi. i want to load another swf that i build and use it's functions. but it seems that when i use getURl('url','_mylevel') it doesn't load the flash file and i get no error. only when i use getUrl('url','_blank') it opens the browser with that url.

i want to be able to use the functions in that swf like the following example:

_root._mylevel.foo(bar);
+1  A: 

The getUrl() method is for opening other web addresses, as in getUrl( "http:google.com" ). It works just like a hyper link in HTML. If I understand your question, it seems that you want to load a swf into the existing swf and call methods on it. In that case, you should use the MovieClipLoader. The following is pseudo-code but should get you close.

var loadListener:Object = new Object();

loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void 
{
    trace( "onLoadComplete" );
    trace( "loaded content: " + target.getInstanceAtDepth(0) );
}

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener( loadListener );

var mc:MovieClip = this.createEmptyMovieClip( "mc", this.getNextHighestDepth() );
mcLoader.loadClip( "nameOfTheSwfYouWantToLoad.swf", mc);
jeremynealbrown
thank you, your example resolved my programming problem.
ufk