| Ultrashock Forums
• [mini-tutorial] Center MovieClip on Stage |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
| 12> | Page 1 of 2 |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
|
2004-12-14
#2 |
||
|
Downloaded ![]() |
|
|
2004-12-15
#3 |
||
|
thanks bluebox! nice scripting there.
|
|
|
2004-12-15
#4 |
||
|
nice tut Bluebox |
|
|
2004-12-15
#5 |
||
|
that is so brilliant.
|
|
2 Creative Assets
|
2004-12-15
#6 |
||
|
Good tutorial, very useful. Downloaded... |
|
|
|
2004-12-15
#7 |
||
|
great tut bluebox
|
|
|
|
2004-12-15
#8 |
||
|
how to add easing on the moiveclip move to center?
|
|
2 Creative Assets
|
2004-12-15
#9 |
||
|
Feel: ActionScript Code:
|
|
|
2004-12-15
#10 |
||
|
AS 2 Class
With permission, though I'd post up an AS2 class that I use all the time does the same thing. Same code and method. ActionScript Code:
When I can generalize it a bit more to be useful for everyone, I've got another class that uses the same methodology to stretch a MC as a background, optionally with a margin, and options to maintain aspect ratio, indicate it's placement (top-center, top-left, etc). |
|
|
2004-12-15
#11 |
||
|
Great Blue. its great tut. I had some problems like that, and maybe I got to use it. perfect |
|
|
2004-12-15
#12 |
||
|
Re: [mini-tutorial] Center MovieClip on Stage
if you're going to use XHTML, this won't validate with the <embed> tags in there. check here: http://www.alistapart.com/articles/flashsatay |
|
|
2004-12-15
#13 |
||
|
Re: Re: [mini-tutorial] Center MovieClip on Stage
Originally posted by sentinels You're right, but in all honesty if you're working with a 100% flash window fill there is no point in needing to validate. That would only apply if you're using flash with other xhtml content.
if you're going to use XHTML, this won't validate with the <embed> tags in there. check here: http://www.alistapart.com/articles/flashsatay |
|
|
2004-12-15
#14 |
||
|
good point.
|
|
|
|
2004-12-15
#15 |
||
|
theJhereg how to use the CenteredMC class? |
|
|
2004-12-15
#16 |
||
|
Sorry feel, neglected to put that in. Save the ActionScript above as "CenteredMC.as" and place it in your class path, or in the same folder as your FLA file. Then, in the library, right click the movie clip you want to be centered, and select Linkage. Check the "export for actionscript" checkbox, and enter "CenteredMC" as the AS 2.0 Class. Flash will take care of the rest. |
|
|
|
2004-12-15
#17 |
||
|
Neverrain thanks for your code. question? how to when resize stage in second time. the box go back to the top and do easing, how can make it start from the current position? |
|
|
|
2004-12-15
#18 |
||
|
theJhereg, it's ok.. i did figurage it out just save the class use "CenteredMC.as" then use i can call it by as ActionScript Code:
|
|
|
|
2004-12-16
#19 |
||
|
what do you think with this centerStage with easing here at http://vumedio.com
|
|
|
|
2004-12-16
#20 |
||
|
try to resize your browser it will slides to center
|
|
|
2004-12-16
#21 |
||
|
Okay, Refined te CenterMC class, and added another class for stretching a background MC, with a few parameters for different uses. I put that full example in another thread to keep from taking over this one. [Example] Center/Background MovieClip Refinement is just a bit of steamlining of the class (had a redundant listener) ActionScript Code:
The example in the other thread shows usage for both. Thanks to bluebox_d for the mini-tutorial, and permission to extend in AS2. |
|
|
|
2004-12-23
#22 |
||
|
this is great BUT. i dont have mx2004 do you have this for mx as welll? many thanks |
|
Creative Assets
|
2004-12-23
#23 |
||
|
Now with added scrollbars when needed!
Last edited by Mounty : 2004-12-23 at 07:11.
OK, can't be arsed to make this a class but here you go: ActionScript Code:
So you'll need an mc on the stage called 'back' which'll always scale to fit the stage. You'll also need a scrollpane instance called 'content_mc' on stage. Plus you'll need a swf called "content.swf" with your content in. Try resizing the stage, you should get scroll bars if the stage size drops below the content size, or if the content is already bigger than the scrollpane. It could still be buggy, definately not optimised, but may just be useful - feel free to improve. Merry Christmas M
|
|
|
|
2004-12-23
#24 |
||
|
Re: Re: [mini-tutorial] Center MovieClip on Stage
Originally posted by sentinels that's a nasty workaround... make a blank swf that loads another swf? not practical. just call the entire flash file via JavaScript. almost everyone has JavaScript enabled.
if you're going to use XHTML, this won't validate with the <embed> tags in there. check here: http://www.alistapart.com/articles/flashsatay |
|
|
|
2004-12-29
#25 |
||
|
I've d/l the file but the lower potion of my background picture was cut off. Any ideas? |
|
|
|
2005-01-05
#26 |
||
|
theJhereg, ive used your method, its ok for the swf and tks a lot! but in the html it refuses to align ...
|
|
|
2005-01-05
#27 |
||
|
stormBliss, The HTML has to be set up pretty specifically so that there is no margin or padding in the body, and the flash object/embed fills 100% height & width of the page. Keep in mind, if you don't set the publishing preferences NOT to publish HTML, flash will continually overwrite your custom HTML every time you publish. Gimme just a few and I'll post up the HTML (blue_box's HTML has some errors and omissions for FireFox). |
|
|
2005-01-05
#28 |
||
|
HTML Code
Okay, here's the basic HTML to get your SWF to fill the page. Tweak to your own use (swf name, params, etc.) Of note: 1) The styles applied to html and body are important. Firefox only allows percent widths and heights if the container has a set width and height. Thus body's container is html. 2) The EMBED and the OBJECT tag BOTH have their height and width set to 100% and a style that also sets their height and width in CSS, and removes any margin. Older browsers ignore the style, and newer browsers can optionally ignore the height width, so I use both. 3) I normally don't use a transitional doctype, but I wasn't sure if I should push a strict doctype and web standards on ya ; ) Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled-1</title>
<style>
html { width:100%;height:100%;margin:0;padding:0 ;}
body { width:100%;height:100%;margin:0;padding:0 ;}
</style>
</head>
<body bgcolor="#000000">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
width="100%"
height="100%"
style="width:100%;height:100%;margin:0;padding:0;"
id="Untitled"
align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Untitled-1.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="Untitled-1.swf"
quality="high"
bgcolor="#000000"
width="100%"
height="100%"
style="width:100%;height:100%;margin:0;padding:0;"
name="Untitled"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
|
|
|
|
2005-01-05
#29 |
||
|
10x a lot!
|
|
|
|
2005-01-05
#30 |
||
|
great tutorial..i was wondering how people do this
|
|
|
2005-02-16
#31 |
||
|
Re: HTML Code
Originally posted by theJhereg Call me crazy, but why in the world would you care if it validates or not... you're using a full window of flash, there's nothing to validate.
Okay, here's the basic HTML to get your SWF to fill the page. Tweak to your own use (swf name, params, etc.) Of note: |
|
|
2005-02-16
#32 |
||
|
Ugh, you're gonna make me remember what the hell I was talking about a month ago? I've slept since then ![]() I'll guess that you're talking about the strict/transitional doctype right? If so the point of a doctype isn't just about validation. It tells the browser what type of content to expect, and how to interpret it. I use strict doctype almost exclusively because it forces IE into a "standards mode" where the box model most resembles firefox/gecko. Is it strictly mandatory, naaa. It's just good practice to use a doctype, and its just the way I do things. If I'm answering the wrong question, feel free to point out what I'm missing. |
|
|
2005-02-17
#33 |
||
|
Align Components: ![]() http://chq.emehmedovic.com/?id=7 I use them everywhere, for every kind of resizability; not only for aligning to Stage, but to implement resizable pane/button/scrollbar/window components, etc. |
|
|
2005-02-17
#34 |
||
|
WOW... It is downloaded - great tut - been wanting to do that for a while now. Cheers |
|
|
|
2005-04-11
#35 |
||
|
<edited> scratch that... works great now!
|
|
|
|
2005-05-17
#36 |
||
|
What about a tiled background?
|
|
|
2005-08-16
#37 |
||
|
Hello all, i need a little help with this movie. i made an MC in that movie that i put on the stage. Now what kind of actionscripts do i have to put on that MC for it to reposition itself on the right of the screen for example, whenever i resize the window. i hope you all understand what i meen.
|
|
|
2005-08-16
#38 |
||
|
Originally posted by stormBliss 10x a lot!
|
|
|
2005-08-16
#39 |
||
|
don't worry about what i posted, i figured it out myself ![]()
|
|
Creative Assets
|
2005-08-22
#40 |
||
|
thnks Jo... very usefull
|
|
| 12> | Page 1 of 2 |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|


41 comments
| 10011 views




2 Creative Assets

Linear Mode