mafness
03-01-2007, 07:43 PM
I have a SWF... in that swf Im loading child SWF's (in one child swf, Im loading a series of xml's and swf's)
now when you load the swf into the parent swf, the file works, but then the parents's buttons dont work, and you cant unload the child swf...
eg
www.mafness.com/indeXXX.html
-Press the "Portfolio" button... this should load the child SWF
- After the "Portfolio" SWF is loaded, press either the "Contact" or "Portfolio" buttons... Upon normal functionality they should unload the "portfolio" swf. and then open their respective SWF's but its not happening...
I have the (this._lockroot=true;) function in place, perhaps Im putting it in the wrong spot...
The code for the button is;
on (press) {
//bounce the box.boxShadow movie (param, endingVal, clipName, speedFactor, bounceFactor)
_root.bounce("_width", newWidth, _parent._parent.boxBg, 10, .6);
_root.bounce("_height", newHeight, _parent._parent.boxBg, 10, .6);
_parent._parent.boxMovieHolder.loadMovie("http://www.mafness.com/portfolio.swf");
}
the main action is ;
fscommand("allowscale", false);
//Creates a unique ID number for each bounce function call
uniqueBounceID = 0;
function bounce(param, endingVal, clipName, speedFactor, bounceFactor) {
//Do not run if the clipName does not exist
if (clipName._x<>undefined) {
//Clear old setIntervals with same param name that might still be firing - prevents the clipName movie from being caught between two different parameter values
clearInterval(_root["bounceInterval"+clipName[param+"ID"]]);
//Reassign variables to make them private variables of the movie clip
var bounceID = _root.uniqueBounceID++;
clipName["param"+bounceID] = param;
clipName["endingVal"+bounceID] = endingVal;
clipName["speedFactor"+bounceID] = speedFactor;
clipName["bounceFactor"+bounceID] = bounceFactor;
clipName["startingParamVal"+bounceID] = clipName[param];
clipName["changedParamVal"+bounceID] = 0;
//Store the bounceID for this parameter into a variable in the clipName movieclip - used to clear the setInterval if the movie clip is removed before the function completes
clipName[param+"ID"] = bounceID;
//Bounce function called from the setInterval
clipName["callBounce"+bounceID] = function () {
//If the clip no longer exists, clear the setInterval
if (clipName._x == undefined) {
clearInterval(_root["bounceInterval"+bounceID]);
} else {
// Don't fire if the destination position is met
if (clipName["endingVal"+bounceID]<>Math.round(clipName[clipName["param"+bounceID]])) {
// Modify the changedParamVal by using a simple friction equation
clipName["changedParamVal"+bounceID] = clipName["changedParamVal"+bounceID]*clipName["bounceFactor"+bounceID]+(clipName["endingVal"+bounceID]-clipName["startingParamVal"+bounceID])/clipName["speedFactor"+bounceID];
// Increment the startingParamVal by the new changedParamVal
clipName["startingParamVal"+bounceID] += clipName["changedParamVal"+bounceID];
// Snaps bouncing object to the pixel to reduce blinking effect and keep fonts pixelized
clipName[clipName["param"+bounceID]] = Math.round(clipName["startingParamVal"+bounceID]);
} else {
//Ensure final destination
clipName[clipName["param"+bounceID]] = clipName["endingVal"+bounceID];
// Clear the setInterval
clearInterval(_root["bounceInterval"+bounceID]);
}
}
//trace(clipName+" "+bounceID+":"+clipName["param"+bounceID]+" = "+clipName[clipName["param"+bounceID]]);
};
//Call the bounce function 100 times per second
_root["bounceInterval"+bounceID] = setInterval(clipName["callBounce"+bounceID], 10);
}
}
Any help would be appreciated... all the files are being loaded into 1 empty movie clip (boxMovieHolder) I would like to be able to fade out the loaded movie clip, and then load the new one...
Thanks in advance...
now when you load the swf into the parent swf, the file works, but then the parents's buttons dont work, and you cant unload the child swf...
eg
www.mafness.com/indeXXX.html
-Press the "Portfolio" button... this should load the child SWF
- After the "Portfolio" SWF is loaded, press either the "Contact" or "Portfolio" buttons... Upon normal functionality they should unload the "portfolio" swf. and then open their respective SWF's but its not happening...
I have the (this._lockroot=true;) function in place, perhaps Im putting it in the wrong spot...
The code for the button is;
on (press) {
//bounce the box.boxShadow movie (param, endingVal, clipName, speedFactor, bounceFactor)
_root.bounce("_width", newWidth, _parent._parent.boxBg, 10, .6);
_root.bounce("_height", newHeight, _parent._parent.boxBg, 10, .6);
_parent._parent.boxMovieHolder.loadMovie("http://www.mafness.com/portfolio.swf");
}
the main action is ;
fscommand("allowscale", false);
//Creates a unique ID number for each bounce function call
uniqueBounceID = 0;
function bounce(param, endingVal, clipName, speedFactor, bounceFactor) {
//Do not run if the clipName does not exist
if (clipName._x<>undefined) {
//Clear old setIntervals with same param name that might still be firing - prevents the clipName movie from being caught between two different parameter values
clearInterval(_root["bounceInterval"+clipName[param+"ID"]]);
//Reassign variables to make them private variables of the movie clip
var bounceID = _root.uniqueBounceID++;
clipName["param"+bounceID] = param;
clipName["endingVal"+bounceID] = endingVal;
clipName["speedFactor"+bounceID] = speedFactor;
clipName["bounceFactor"+bounceID] = bounceFactor;
clipName["startingParamVal"+bounceID] = clipName[param];
clipName["changedParamVal"+bounceID] = 0;
//Store the bounceID for this parameter into a variable in the clipName movieclip - used to clear the setInterval if the movie clip is removed before the function completes
clipName[param+"ID"] = bounceID;
//Bounce function called from the setInterval
clipName["callBounce"+bounceID] = function () {
//If the clip no longer exists, clear the setInterval
if (clipName._x == undefined) {
clearInterval(_root["bounceInterval"+bounceID]);
} else {
// Don't fire if the destination position is met
if (clipName["endingVal"+bounceID]<>Math.round(clipName[clipName["param"+bounceID]])) {
// Modify the changedParamVal by using a simple friction equation
clipName["changedParamVal"+bounceID] = clipName["changedParamVal"+bounceID]*clipName["bounceFactor"+bounceID]+(clipName["endingVal"+bounceID]-clipName["startingParamVal"+bounceID])/clipName["speedFactor"+bounceID];
// Increment the startingParamVal by the new changedParamVal
clipName["startingParamVal"+bounceID] += clipName["changedParamVal"+bounceID];
// Snaps bouncing object to the pixel to reduce blinking effect and keep fonts pixelized
clipName[clipName["param"+bounceID]] = Math.round(clipName["startingParamVal"+bounceID]);
} else {
//Ensure final destination
clipName[clipName["param"+bounceID]] = clipName["endingVal"+bounceID];
// Clear the setInterval
clearInterval(_root["bounceInterval"+bounceID]);
}
}
//trace(clipName+" "+bounceID+":"+clipName["param"+bounceID]+" = "+clipName[clipName["param"+bounceID]]);
};
//Call the bounce function 100 times per second
_root["bounceInterval"+bounceID] = setInterval(clipName["callBounce"+bounceID], 10);
}
}
Any help would be appreciated... all the files are being loaded into 1 empty movie clip (boxMovieHolder) I would like to be able to fade out the loaded movie clip, and then load the new one...
Thanks in advance...