PDA

View Full Version : Help Resizing MovieClip


jlach01
01-26-2005, 02:29 PM
Hey yall... I have searched for help on this, but I haven't been able to locate anything that might help me with the problems I'm having. Heres whats going on.. I have my main .swf file, wich has the links and all.. when you click a link, it shows a movie clip on part of the main .swf file. I want this MovieClip to be scrollable, so I need to be able to set the size of the MovieClip, wich might be smaller then the actual size of the movie i'm loading.. The problem I'm having is the minute i try to set _width and _height is my movieclip dosen't show. I'm using a MovieClipLoader... heres the code, Thanks in advance! :)


var contentMCL:MovieClipLoader = new MovieClipLoader();
var contentMCListener = new Object();

// -- Object Listeners --
contentMCListener.onLoadStart = function(targetMC) {
contentMC._visible = 0;
txtLoad._visible = 1;
txtLoadProgress._visible = 1;
progressText = "<p align=\"center\">Getting Total Bytes...</p>";
};
contentMCListener.onLoadProgress = function(targetMC, loadedBytes, totalBytes) {
loadProgress = Math.ceil((loadedBytes / totalBytes) * 100);
if (!loadProgress) {
loadProgress = 0;
}
progressText = "<p align=\"center\">Completed: " + loadProgress + "%</p>";
};
contentMCListener.onLoadComplete = function(targetMC) {
progressText = "<p align=\"center\">All Bytes Recieved</p>";
};
contentMCListener.onLoadInit = function(targetMC) {
txtLoad._visible = 0;
txtLoadProgress._visible = 0;
contentMC._visible = 1;
};
contentMCL.addListener(contentMCListener);

// -- Functions --
function loadContent(path:String):Void {
contentMCL.unloadClip(contentMC);

contentMC._width = 440;
contentMC._height = 430;

contentMCL.loadClip(path, contentMC);
}

// -- On 'Home' Button --
on (release) {
loadContent("home.swf");
}

jlach01
01-26-2005, 02:45 PM
Whoops.. I messed up, i forgot I can't load the movie till its fully loaded.. so the code changed to put the movie resize in the .onLoadInit function, and it shows, but this posses another problem.. it actually resizes the whole movie, i don't want this.. i just want the "holder" of this movie to resize... not the actual movie, cause I need to be able to scroll the movie.... any advice?

Morg
01-26-2005, 03:43 PM
HEy

Is holder a movieClip inside your contentMC movieClip?

jlach01
01-26-2005, 04:46 PM
nope.. I'm loading into contentMC... is that the problem?

Morg
01-27-2005, 05:56 AM
Ok, I see what you mean by 'holder'.

If you want to scale yur movieClip, but keep the size of the original one, you need to load it into another clip inside of your original clip. eg.

_root.contentMC.holderClip._width = 400;
_root.contentMC.holderClip._height = 400;

So, your parent clip will kep its original size, but the 'holderClip' will scale.

Thus, inside of contentMC, you would need another clip:

contentMCL.loadClip(path, contentMC.holderClip);

Hope this makes sense... ;)

windson2002
01-27-2005, 06:25 AM
Try this Code:

contentMCListener.onLoadComplete = function(targetMC) {
progressText = "<p align=\"center\">All Bytes Recieved</p>";
contentMC._width = 440;
contentMC._height = 430;
};