I am using a code that will center my "mainsite" movie clip and keep it
centered even on resize. However becuase it centers it when the browser window
is scaled smaller than the MovieClip / SWF (800x650) it continues to center the
clip and cuts off the top/bottom and left/right and does not enable the scroll
bars in the browser.
I need a code that will stop the movie at 0,0 (top, left corner) and enable
the browser scroll bars accordingly to view the rest of the site that was clip
on the other three sides.
I only need this to happen on browser resize and when it goes smaller than my
swf/movie clip (800px by 650px)!
Good Example of this would be MTV.com scale the browser window and watch how
the MovieClip stops at 0,0 (top,left)!
Here is my centering code in case anyone needs it to tac more code onto or for
more information. Thanks in advance!
var stageL:Object = new Object();
stageL.onResize = function() {
sW = Stage.width;
sH = Stage.height;
mainsite._x = (sW - mainsite._width) / 2;
mainsite._y = (sH - mainsite._height) / 2;
xmin = mainsite._x-mainsite._width/2;
ymin = mainsite._y-mainsite._height/2;
}
Stage.addListener(stageL);
kglad - 23 Mar 2007 06:03 GMT
try:
var stageL:Object = new Object();
stageL.onResize = function() {
sW = Stage.width;
sH = Stage.height;
mainsite._x = Math.max(0,(sW - mainsite._width) / 2);
mainsite._y = Math.max(0,(sH - mainsite._height) / 2);
xmin = mainsite._x-mainsite._width/2;
ymin = mainsite._y-mainsite._height/2;
}
Stage.addListener(stageL);
Non-nelson - 23 Mar 2007 09:20 GMT
Weird...I tried attaching that same script on root but it doesn't resize to [b]0,0 (top,left)[/b] like its supposed to.
Just wondering whether any script have to be done for the html?
bcounts - 23 Mar 2007 08:30 GMT
kglad - 23 Mar 2007 21:33 GMT
10000=10000 milliseconds = 10 seconds.
30 minutes=30*60seconds=30*60*1000milliseconds=1800000.
bcounts - 23 Mar 2007 22:53 GMT
Thanks For The Converstion!
I have another thread I just created about letter sequences - if you get a
chance could you take a look and maybe shed some light - there was one person
along the right lines but has not answered me back since.
Thanks Thanks Thanks
kglad - 23 Mar 2007 23:41 GMT
you're welcome.
Non-nelson - 24 Mar 2007 04:22 GMT
I hope i am not bring rude here but i am just curious to know how it works.
Some help will be very much appreciated. Thanks...
kglad - 24 Mar 2007 04:36 GMT
var stageL:Object = new Object();
stageL.onResize = function() { // this is a listener for the Stage (set
below) that executes whenever there's a resize
sW = Stage.width;
sH = Stage.height;
mainsite._x = Math.max(0,(sW - mainsite._width) / 2); // this assigns the
movieclip mainsite's _x property to be horizontally centered if
Stage.width>=mainsite._width and assigns the _x property to zero otherwise
mainsite._y = Math.max(0,(sH - mainsite._height) / 2); // likewise with the
_y property
xmin = mainsite._x-mainsite._width/2; // i have no idea what this is for but
may be used elsewhere
ymin = mainsite._y-mainsite._height/2;
}
Stage.addListener(stageL); // this assigns stageL to listen to Stage events
(like onResize)
Non-nelson - 31 Mar 2007 06:04 GMT
Hi Kglad,
Apologize for the almost retard response but I like to know how should I
position the swf in the HTML Doc.
Coz it doesn't seem to resize itself if I enclose it in a table cell, is a
liquid layout needed to achieve the resize?
Much thanks..
kglad - 31 Mar 2007 16:44 GMT
do you have a movieclip with instance name mainsite?
Non-nelson - 31 Mar 2007 17:04 GMT
Non-nelson - 31 Mar 2007 17:04 GMT
Non-nelson - 31 Mar 2007 17:04 GMT
kglad - 31 Mar 2007 17:23 GMT
have you published your swf with html dimensions 100%? do you have
Stage.scaleMode = "noScale";
in your swf?
Non-nelson - 31 Mar 2007 17:28 GMT
Thanks....its working now. Omitted the [Stage.scaleMode = "noScale";]
kglad - 31 Mar 2007 17:50 GMT