Chewie
08-31-2005, 11:57 AM
Hi,
I am trying to load a child swf into a parent swf using a load button and using onLoadComplete check to see if it fully loaded and then set the movieclips coordinates in the child swf from data stored in a shared object.
Here is the code I have for the load button.
loadbutton.onRelease = function() {
var mclLoader = new MovieClipLoader();
var oListener:Object = new Object();
oListener.onLoadComplete = function(hull:MovieClip) {
trace("SWF Loaded");
trace(mySharedObject.data.hull_sideX);
hull.mcSide._x = mySharedObject.data.hull_sideX;
hull.mcSide._y = mySharedObject.data.hull_sideY;
hull.mcTop._x = mySharedObject.data.hull_topX;
hull.mcTop._y = mySharedObject.data.hull_topY;
trace(hull.mcSide._x);
};
mclLoader.addListener(oListener);
mclLoader.loadClip(mySharedObject.data.hullFileNam e, hull);
};
The swf loads fine but it does not get positioned like it should do. The trace(mySharedObject.data.hull_sideX); line traces the coordinate ok but the trace(hull.mcSide._x); is remaining undefined.
However if I create a test button, thus
btnTest.onRelease = function() {
hull.mcSide._x = mySharedObject.data.hull_sideX;
hull.mcSide._y = mySharedObject.data.hull_sideY;
hull.mcTop._x = mySharedObject.data.hull_topX;
hull.mcTop._y = mySharedObject.data.hull_topY;
};
pressing this button after pressing the load button positions the movieclips within the child swf file no problem at all using the data from the shared object.
I just cant see why this does not work
I am trying to load a child swf into a parent swf using a load button and using onLoadComplete check to see if it fully loaded and then set the movieclips coordinates in the child swf from data stored in a shared object.
Here is the code I have for the load button.
loadbutton.onRelease = function() {
var mclLoader = new MovieClipLoader();
var oListener:Object = new Object();
oListener.onLoadComplete = function(hull:MovieClip) {
trace("SWF Loaded");
trace(mySharedObject.data.hull_sideX);
hull.mcSide._x = mySharedObject.data.hull_sideX;
hull.mcSide._y = mySharedObject.data.hull_sideY;
hull.mcTop._x = mySharedObject.data.hull_topX;
hull.mcTop._y = mySharedObject.data.hull_topY;
trace(hull.mcSide._x);
};
mclLoader.addListener(oListener);
mclLoader.loadClip(mySharedObject.data.hullFileNam e, hull);
};
The swf loads fine but it does not get positioned like it should do. The trace(mySharedObject.data.hull_sideX); line traces the coordinate ok but the trace(hull.mcSide._x); is remaining undefined.
However if I create a test button, thus
btnTest.onRelease = function() {
hull.mcSide._x = mySharedObject.data.hull_sideX;
hull.mcSide._y = mySharedObject.data.hull_sideY;
hull.mcTop._x = mySharedObject.data.hull_topX;
hull.mcTop._y = mySharedObject.data.hull_topY;
};
pressing this button after pressing the load button positions the movieclips within the child swf file no problem at all using the data from the shared object.
I just cant see why this does not work