|
-
background filling entire screen. well, i try and try, but...
hi!
i found this thread, and i've been trying to get it to work: http://flashkit.com/board/showthrea...ht=fill+browser
unfortunately i fail, although i try to follow the instructions. something i do wrong. so i was wondering if it was possible for anyone maybe to mail me a functioning fla..? that way i could learn where my mistake was. here's the code i copied from that thread:
HTML Code:
// noScale prevents content in the movie resizing (unless we tell it to!)
Stage.scaleMode = "noScale";
// LT means all positions measured from the top left hand corner
Stage.align = "LT";
// a function to be called when the movie resizes
// this will resize the background clip to fill the stage
bg.onResize = function() {
this._width = Stage.width;
this._height = Stage.height;
};
// get the bg clip to listen for events (onResize)
// broadcast by the stage object
Stage.addListener(bg);
bg._x = bg._y = 0;
bg.onResize();
// this function will position the content clip in the centre
// when the movie resizes
content.onResize = function() {
this._x = (Stage.width - this._width) / 2;
this._y = (Stage.height - this._height) / 2;
};
Stage.addListener(content);
content.onResize();
i hope this is not too much to ask! instead of learning, i feel i'm getting more stupid every day. flashbacks, i guess. grrrr.
thank you.
mar
-
I think that line #5
Code:
Stage.align = "LT";
should be(Change in bold):
Code:
Stage.align = "TL";
/Mirandir
-
now we're talking! yessssh... great! thanks a lot!
-
hey... i got one more question now:
i tried placing my fla's into the content mc, as adviced. i placed my main movie swf inside an empty mc inside content mc using loadMovie command. well, the content mc is nicely centered, with my level 0 movie in it, just as it should be. but all the other movies that i have in other levels+ other mc's take their 0,0 point from the screen's top lef corner instead of the content mc's top left. this means that they are all in the wrong place. now i could, of course, use 'this._x=something, this._y something' for each swf - but as the content mc moves in different screens, that means that all my swf's in other levels except 0 level will again be incorrectly positioned.
so how to make sure that the swf's in other levels will be in right places in different screens?
-
A dirty trick is to hardcode the stage size of the movie you load into a level and then use something like this:
Code:
listener = {};
// Hardcoded stage size of 550 x 440:
listener.stageWidth = 550;
listener.stageHeight = 440;
listener.onResize = function()
{
// Calculate position
_root._x = (Stage.width - this.stageWidth) / 2;
_root._y = (Stage.height - this.stageHeight) / 2;
}
listener.onResize();
Stage.addListener(listener);
But I guess you could also align the level(s) with the content movieclip in level0.
Something like this:
Code:
content.onResize = function() {
this._x = (Stage.width - this._width) / 2;
this._y = (Stage.height - this._height) / 2;
for(i = 1; i < numberOfLevels + 1; i++)
{
this["_level" + i]._x = this._x
this["_level" + i]._y = this._y
}
};
Where "numberOfLevels" is the highest level used.
/Mirandir
-
'dirty?!!' nnaaahhh: it works, so it cannot, by nature, be dirty! and besides, if playing dirty is what it takes to make it work, i'll plunge into filth without the slightest remorse
for some reason, there seems to be a couple of pixels difference that i have to adjust by changing the position of objects and mc's in my swf's in different levels. it's no problem to do that, of course: i just faintly wonder why. all my swf's in different levels are the same stage size as the level0 swf, and positioned at 0,0. main thing still is that i can get it to work. hah, the beauty spots are of secondary importance!
i didn't succeed with the second trick you adviced, though. i have nine levels in my site. so i replaced the numberOfLevels with a 9, and then pasted the given code into the first frame of level0 swf, replacing the earlier contentonresizestuff. tried different variations also, just adding the bit without removing anything from the earlier code version etc. but no: only the level0 movie stays where it should, all others jump to top left corner.
but although i like to learn and understand, my fuzzy logic way of thinking (+questionable morals, as we unfortunately now know...) allow me to have gaps in my perfect knowledge. one of the recipes already works for me, and that's great. so, you there: thankssssssss!!!!! ¤
-
ok. back to work after a long weekend. again i stumble into a problem. so, one more question, if i may:
i started loading in my swf's with texts. and surprise surprise: as the movies now adapt to the screen, the fonts jump out of exact pixels and become blurry. yikes! also my text scrolls are not working, which, i guess, mus be because of the non exact pixel values... ouch. bad thing.
is there a way to add a sentence to this 'dirty trick' that tells it to round the pixels always to closest even number, so that the fonts would remain crispy and the texts would scroll again?
Last edited by mrk13; 08-01-2005 at 10:17 AM.
-
Well AFIAK all you need to do is round the numbers:
Code:
listener.onResize = function()
{
// Calculate position
_root._x = Math.round((Stage.width - this.stageWidth) / 2);
_root._y = Math.round((Stage.height - this.stageHeight) / 2);
}
/Mirandir
-
yes, that took care of the texts. you've been really helpful - thanks a lot, your help is very much appreciated!
i hope i'm not being a pain in the ass, but i'm still hopelessly in trouble: the dynamic text blocks won't scroll any more, no matter what i do. argh! i suspect there must be a clash between bg resizing / 'dirty trick' commands and my scrolltext commands, as the text scrolls ok when i don't try to position the text.swf with the now screen-adapting other swf's, and just let the text.swf stay stuck in the top left corner.
my knowledge of coding is not nearly enough that i could fix the thing myself... so, a very pretty please: here's the code that i'm using for example for the down arrow button for the dynamic text box. that's where the trouble is..? is it the path that has now changed, because all is being loaded into the content mc? i've tried changing the paths, but still... 
HTML Code:
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
scrollup = true;
}
}
onClipEvent (mouseUp) {
scrollup = false;
}
onClipEvent (enterFrame) {
if (scrollup) {
_root.scrolltext.scroll += 1;
gotoAndStop(2);
} else {
gotoAndStop(1);
}
}
onClipEvent (load) {
gotoAndStop(1);
}
Last edited by mrk13; 08-01-2005 at 06:17 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|