Skip to main content
melas076
Known Participant
April 30, 2011
Question

PROBLEM TO LOADMOVIE SWF INTO FLASH

  • April 30, 2011
  • 1 reply
  • 732 views

dear ALL,

I am facing a problem with LOADMOVIE.

I did a MC called "bgproducts" on the root frame no:46 to 59 then stop();  and in this MC, you have an animation and stop at frame no :64 then stop();

in the frame 64, i have another an empty MC called "productsMC".

when i do this code in bgproduct frame no 64 :

productsMC.loadMovie("main.swf", "");

it plays the frame on the root 46 to 59 non-stop and nothing to loadmovie, and also the main.swf has a preoloader then frame 2 an load from xml file.

thanks and i will appreciate your help!!!!!!!!

MELAS

This topic has been closed for replies.

1 reply

melas076
melas076Author
Known Participant
April 30, 2011

this is the preloader code of the main.swf in the first frame on the root:

stop();
//
var xo:XML = new XML();
xo.ignoreWhite = true;
xo.onLoad = function() {
    _root.onEnterFrame = checkIfMovieLoaded;
};
function checkIfMovieLoaded() {
    if (_root.getBytesLoaded() == _root.getBytesTotal()) {
        delete _root.onEnterFrame;
        _root.gotoAndStop(2);
        _root._visible = false;
    }
}
xo.load(xml == undefined ? "data.xml" : xml);

i hope you understand this problems

thanks and regards,

MELAS

Inspiring
May 2, 2011

I think this is what you want.

stop();
//
var xo:XML = new XML();
xo.ignoreWhite = true;
xo.onLoad = function(success:Boolean) {

   if(success){
        _root.gotoAndStop(2);
        _root._visible = false;

    }
};

xo.load(xml == undefined ? "data.xml" : xml);

The onLoad event for an XML file happens when the file is done loading, not when it starts loading.

Of course I'm not sure why you would want to make the _root invisible. Since the root is the container for everything you will have nothing visible then.

Also I'm not sure why you talk about loadmovie, that is for loading external swf, jpg, png, etc. And not XML.

And even in your strange checkIfMovieLoaded() function why would you be trying to check the bytes loaded in the _root if you are loading xml or assuming you were actually trying to loadmovie?