View Full Version : Full Scale Gradient Background
vilehelm
04-06-2006, 02:26 PM
http://www.duffy.com
So, I would like to know exactly how this is pulled off.
I've come kinda close but have yet to get an effect that is as dependable as this one.
The gradient must be full screen, the entire screen must be flash, the MC on the inside must NOT scale but float around in the middle and be transparent to the background.
A script that I found on Creative Cow (well pink found it actually) is the best I've gotten so far.
Stage.scaleMode = "noScale";
reSizeFunction = function() {
//Gradient Bit
_root.bg_gradient._height = Stage.height;
_root.bg_gradient._y = 0-((Stage.height - 768)/2);
_root.bg_gradient._width = Stage.width;
_root.bg_gradient._x = 0-((Stage.width - 1024)/2) ;
}
myEye = new Object();
Stage.addListener(myEye);
myEye.onResize = reSizeFunction;
_root.bg_gradient._height = Stage.height;
_root.bg_gradient._y = 0;
_root.bg_gradient._width = Stage.width;
_root.bg_gradient._x = 0-((Stage.width - 1024)/2) ;
just change the numbers to match up with your bg image and movie. I get some very buggy behavior with this however on Safari but i don't get it with the Duffy site so I' assuming that they pulle dit off some other way.
Thanks.
vilehelm
04-06-2006, 02:52 PM
nevermind!
pink cleaned it up for me, ty babe
// ***Stage aligned top left
Stage.align = "TL";
// *** Stop the stage from scaling with the browser window.
Stage.scaleMode = "noScale";
stop ();
// initiate postitions and scaling values for objects
myContent._x = Stage.width/2
myContent._y = Stage.height/2
gradient_bg._height = Stage.height;
gradient_bg._width = Stage.width;
// end initial position setting
//create a listner that checks to see if the browser window is resized
sizeListener = new Object();
sizeListener.onResize = function() {
// change movieclip properties when the window is resized.
myContent._y = Stage.height/2;
myContent._x = Stage.width/2;
gradient_bg._height = Stage.height;
gradient_bg._width = Stage.width;
};
Stage.addListener(sizeListener);
jamesbooth
04-06-2006, 05:06 PM
Is there any way of doing this with an image as the background so the image scales and the other content stays the same scale?
Ive looked all over for a way of doing this but i'm not clever enough with as to figure if out.
thank you
James
vilehelm
04-08-2006, 02:38 PM
Is there any way of doing this with an image as the background so the image scales and the other content stays the same scale?
Ive looked all over for a way of doing this but i'm not clever enough with as to figure if out.
thank you
James
It is an image, or it can be. Just drop your BG into the background mc and voila.
Ricod
04-09-2006, 01:33 PM
Whoa, blast from the past!
Wuddudu dudu dududududup? (yikes, bad pun ... :rolleyes: )
jamesbooth
04-11-2006, 11:12 AM
Hey,
I've tried to re-create that file using your code you re-posted and it hasn't been working for me.
The gradient doesn't go full screen but the myContent mc does center itself in the swf, but when i publish it in a html file it doesn't work at all.
do you know why?
thanks
james
jamesbooth
04-12-2006, 10:42 AM
Ok i've managed to get that last bit of code working, but its not exactly what i wanted.
The image fits to the browser size but distorts, is there anyway of making the image scale up and down without the distortion in the dimentions?
Thank you
James
davoatmeshmedia
11-24-2006, 03:40 PM
Wondering whether you could help me a little of your script... Seem to be having trouble getting it to work...
The script you have in your second post here works fine with the flash browser window when test movie is ran, but not at all when the site is loaded up on to the web..... It as if the actionscript used to adapt to the internet browser window doesn't function atall
Would be most appreciative of some help....
Davo......
jamesbooth
11-24-2006, 03:46 PM
If you go to Publish in the properties pannel under the html tab you need to export with different scale properties. I'm not too sure which to hand. if you search under the past discussions there is alot about how to get it working.
hope that helps.
davoatmeshmedia
11-24-2006, 03:57 PM
Cheers James..
You don't know how many days iv'e spent trying to figure this out... Such a pain, but it can't be that difficult.....
Where do you ply your trade mate??
Davo....
davoatmeshmedia
11-24-2006, 04:33 PM
Hi James....
Sorted it.... Got my script workin fine now and sorted the publish settings to percent 100 rather than having it on Match Movie...
The problem now is that in the browser window i have a gap in between the edges of the browser and the edges of the gradient movie clip and the colour is the colour of my Document Background in flash... One pain after another....
Any ideas??
Davo...
d-woo
04-04-2007, 05:42 AM
In the HTML that is holding the swf, add
<style>
body {margin:0px;padding:0px}
</style>
davoatmeshmedia
04-04-2007, 09:10 AM
Cheers for that mate.
Still hadn't figured that out..
Nice one.....
Davo....
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.