R – How to load and external swf AND gotoAndPlay() with ONE button

actionscript-2flashgotoonloadtimeline

I've made an interactive tour which can be seen here.

The main swf is the nav at the top. And I load 4 external swfs into the main (About, Rentals, Floorplan, Neighborhood).

I need a button in Floorplan.swf to load Rental.swf AND gotoAndStop("CAFE") – a frame within Rental.swf.

This is the code that I am working with right now:

btnFLRcafe.onRelease = function(){ 

var loader:MovieClipLoader = new MovieClipLoader(); 
loader.addListener(this); 

function onLoadComplete(loadedClip) { 
loadedClip._root.mcRENTALS.gotoAndStop("CAFE"); 
} 

loader.loadClip("maps_92Tri_RentalsMain.swf", 1); 
}

The code will load the swf, but it DOES NOT gotoAndStop. I've rearrange and rewrote – nothing worked. When I put traces on the code, it seems that onLoadComplete isn't even being called. I am at a loss.

I can send files if needed.

Best Answer

Instead of having a method for onLoadComplete, try adding one called onLoadInit(loadedClip)


Here is some basic code for what I think you are trying to do. I have a main swf which has a button on the stage. On the button, I had the following actions...

on(release) {

    var loader:MovieClipLoader = new MovieClipLoader();
    loader.addListener(this);

    function onLoadInit(loadedClip:MovieClip) {
        _root.contentArea.gotoAndPlay("ANIMATE");
    };

    loader.loadClip("Loaded.swf", _root.contentArea);
}

In the main move, I have another clip on the stage named contentArea where the Loaded.swf file will be loaded in. Loaded.swf has a frame label called "ANIMATE" which starts a small animation on the timeline.

Related Topic