-
Ran across this great thread and got the full screen/resize element to work great using whispers' fullscreen example (fullScreen_reSize_newMouse).
My question is this: I've placed some buttons on the screen, and want to load movieclips onto the stage using this.
Code:
on (release) {
this.attachMovie("mcSpecialists","mcSpecialists",10);
}
How can I load the mcSpecialists movieClip so that it's at the center of the stage?
Thanks
Last edited by landrvr1; 11-06-2008 at 06:28 PM.
-
bump.
Any thoughts?
I've added this code to a button, and it brings in a movieClip just fine but not at the center of the stage. A bit off-center, and I need the clip to stay on center during a resize.
Code:
on (press) {
this.attachMovie("mcSpecialists", "mcSpecialists", 10);
mcSpecialists._x = Math.ceil(Stage.width/2-test._width/2);
mcSpecialists._y = Math.ceil(Stage.height/2-test._height/2);
centercontent();
}
I truly need to learn how to bring in a clip and have it centered.
-
Senior Member
I dont see why thats not working...
is the movie Clip you are attaching have the registration point the top/left?
maybe this:
PHP Code:
on (press) { var newClip = attachMovie("mcSpecialists", "mcSpecialists", 10); newClip._x = (Stage.width/2) - (newClip._width/2); newClip._y = (Stage.height/2( - (newClip._height/2); centercontent(); }
-
Why not just put your main flash movie inside a div, set height to 100% and then use Javascript to resize the div based on the screen resolution?
You can estimate around 200px for browser elements, resize your DIV to match the screen height - 200px, and you end up with s site that fits perfectly in anyone's browser window with verly little work.
Just make sure to enable smoothing on all your bitmaps...
-
Senior Member
how does that solve centering an attached object inside the flash movie then? (which is what hes asking)...
also to the OP-
if you want to scale/re-size something.. your objects registration point would have to be center..
-
Originally Posted by whispers
I dont see why thats not working...
is the movie Clip you are attaching have the registration point the top/left?
maybe this:
whispers, thanks much. That bit of reworking you did in the code worked perfectly. I just substituted the 'newClip' with 'mcSpecialists' and away we went!
The trouble I'm having now is that I've got 4 buttons on my main movie that each call a different movieClip. Each clip will come in centered on the stage, but only 1 will stay centered when I do a resize. Any idea as to how each can stay centered? Here's the code I've got for the first 2 buttons. Nothing special, just calling out a different clip in each:
Code:
myListener = new Object();
myListener.onResize = centercontent;
Stage.align = "LT";
Stage.addListener(myListener);
function centercontent() {
mcSpecialists2._x = Math.ceil(Stage.width/2-mcSpecialists2._width/2);
mcSpecialists2._y = Math.ceil(Stage.height/2-mcSpecialists2._height/2);
}
centercontent();
myListener = new Object();
myListener.onResize = centercontent;
Stage.align = "LT";
Stage.addListener(myListener);
function centercontent() {
mcSpecialists._x = Math.ceil(Stage.width/2-mcSpecialists._width/2);
mcSpecialists._y = Math.ceil(Stage.height/2-mcSpecialists._height/2);
}
centercontent();
My guess is that I need a different kind of listener, as they might be fighting each other? My knowledge in that area is very limited, so I'm just grasping at straws. Thanks again.
Last edited by landrvr1; 11-07-2008 at 10:06 PM.
-
Thought I'd circle back and post the solution here in case anyone has the same trouble. asf8 helped me sort this out. Just as I thought, the duplicate naming was the culprit. Here's the code that fixed it:
Code:
Stage.align = "TL";
Stage.scaleMode = "noScale";
//
myListener = new Object();
myListener.onResize = centercontent;
Stage.addListener(myListener);
//
function centercontent() {
wallPaper_mc._x = Math.ceil(Stage.width/2-wallPaper_mc._width/2);
wallPaper_mc._y = Math.ceil(Stage.height/2-wallPaper_mc._height/2);
mcSpecialists._x = Math.ceil(Stage.width/2-mcSpecialists._width/2);
mcSpecialists._y = Math.ceil(Stage.height/2-mcSpecialists._height/2);
mcSpecialists2._x = Math.ceil(Stage.width/2-mcSpecialists2._width/2);
mcSpecialists2._y = Math.ceil(Stage.height/2-mcSpecialists2._height/2);
mcSpecialists3._x = Math.ceil(Stage.width/2-mcSpecialists3._width/2);
mcSpecialists3._y = Math.ceil(Stage.height/2-mcSpecialists3._height/2);
}
//
centercontent();
Thanks again, whispers, for the assist here. Much appreciated.
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
|