FLASH HELP!!
- Started
- Last post
- 16 Responses
- oneSaint
I'm curently trying to develope a centered layout in flash, which would stay centered with any type of change of a windows dimensions. example. http://www.limbapparel.com/main.… If anyone could help me out, I'd be really appreciate it!
- sauerbraten0
you need to use the Stage property, use a listener also to keep the site updated w/ the user resizes the browser window, etc.
i wrote some stuff about it and there's some code in this thread on YH! http://www.yayhooray.com/thread/…
- lucky690
Last line.. CONTENT is the palce where you want to attach your design into...
this script will keep the Flash movie centred & unscalable inside a fullscreen browser window.
put these the first frame, of your root swf.
// CENTRE & RESIZE INIT VALUES
_focusrect = false;
Stage.align = "TL";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
Stage.addListener(this);// CENTRE & RESIZE FUNCTION
var contX:Number;
var contY:Number;this.onResize = function(){
// align the stage
container_mc._x = int((Stage.width - 800) / 2);//
container_mc._y = int((Stage.height - 600) / 2);//contX = container_mc._x;
contY = container_mc._y;}
// CREATE & CENTRE BASE MOVIE
this.createEmptyMovieClip("conta...this.container_mc._x = int((Stage.width - 800) / 2);
this.container_mc._y = int((Stage.height - 600) / 2);contX = this.container_mc._x;
contY = this.container_mc._y;// CREATE CONTENT HOLDER
this.container_mc.createEmptyMov...
_global.CONTENT = this.container_mc.content_mc;let me know if you r having troubles...
- lucky690
wicked site; especially the media player. very nice treatment all over.
well done!
- oneSaint0
Hey bro thank you so much for helping me out, my attemps to center the page with your script has faiiled. I just can't seem to center this friggen flash site... Do you have an aim or msn account we could chat over?
Thanks again to your time.
- Mik
- imakedesign0
are using mx2004?
- silencer0
Does anyone know how to keep the content part pixel perfect? (ie: when the browser resizes, pixel fonts don't blur)
- imakedesign0
Stage.scaleMode = "noScale";
- silencer0
That line of script is already in my file. I mean when the user resizes the browser the clip which is being centred becomes slightly blurred. I definetly not scaling it's just not snapping to the pixels (You know when you place a pixel font t x0.3 y0.4, that sort of thing) Sorry for hi-Jackin the thread by the way!
- imakedesign0
i have never had the problem.. can you post a fla?
- silencer0
Sure, cheers!
http://www.adamrodgers.net/forum…
The vertical lines are contained within the 'content_mc' in the library. This clip seems to be blurring on resize, but the rest of the code works fine)
- imakedesign0
i cant see any text?
- silencer0
Yeah I just removed the content so the file size would be smaller to download. If you re-size it a couple of times you'll see the vertical lines are sometimes pixel perfect and other times they are blurred.
- imakedesign0
had a look at it and It does not do it for me!
- unfittoprint0
'Math.round' the _y/_x values of your mc[s] during the onResize event.
- silencer0
Cheers unfit, altho I tried that already and it doesn't seem to work. I tried adding Math.round(content_mc._x);
into the centre function (which is triggered on the resize) and I also tried adding it into the actual listener function itself to no avail.
- silencer0
juas added this to the resize function. Works like a charm, cheers unfit.
content_mc._x = Math.round((Stage.width-content...