FRIHOST ē FORUMS ē SEARCH ē FAQ ē TOS ē BLOGS ē COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


how to center swf title to a flash website does anyone know?





zaxacongrejo
hi im using a flash website and i added a title
that actualy is an swf the way i did it
it was by inserting the element to the action scrip

var Xpos:Number=60;
var Ypos:Number=5;
var swf:MovieClip;
var loader:Loader=new Loader();

var defaultSWF:URLRequest= new URLRequest("swfs/title.swf");

loader.load(defaultSWF);
loader.x=Xpos;
loader.y=Ypos;
addChild(loader);

but now im facing the never ending problem of centering

becuase i did it in screan 1024 x760 and for me it looks good i just notice now that in other resolutions
the title(swf) is not centered with the website
does anyone know a way to solve this?
Dialogist
I'm not really sure you can Confused

Theoretically you may be able to add an event listener to check for the users resolution, although its doubtful, unless you came up with some eccentric way of aligning two objects -x and x and determining the distance between, which would be madness imo... if you managed that then you could add an if conditional to display the element approximately center for each but it seems extremely convoluted.

I'm guessing the swf is a full screen implementation? But does it have to be? How much detail/content have you got going on in the left and right and top and bottoms margins?

See the margin auto methods of centering can problematic even with css to this day, and only one of them respects window resizing, which I am currently using, but it's methods for vertical alignment are also eccentric. You can (if it is a text element) utilize css to control its behavior even in flash using a dynamic text imput but I doubt that would get you much further. The actionscript only centers according to the swf's dimensions. So...

My solution would be to embed the swf at a set size of the smallest resolution and auto-align the swf left and right, top and bottom in the html with css and fake the page background color/image as being part of the swf. If it is a flat color, easy. If it is an image, subtle blending with transparent feathering around all edges with windowless embed should see you right.

Edit: It's not doubtful:

http://stackoverflow.com/questions/1048566/how-do-i-get-the-users-screen-resolution-in-actionscript-3

But full screen flash is a bit played out (mobiles etc). So 2 solutions, the first (ad hoc) giving you more cross browser flexibility imo.
zaxacongrejo
hi

"I'm guessing the swf is a full screen implementation? "

is just the title but from left to right you can say its a full screan i guess

"But does it have to be?"

honetly dont know i just want a title that fits with the website

"How much detail"

not sure but i belive that setting is at the max

"content have you got going on in the left and right and top and bottoms margins? "

nothing is just the title i manage how to adujt his position to fit well at 1024x760 but it dosent adjust position in resolution changes
Dialogist
Can you post the code that you are using to embed this swf in the html page please?

It will help me to give you a perfect solution to your problem in my next post.
zaxacongrejo
sure i can im the one looking for help

<!-- embedding SWF -->

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="swffit.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.allowfullscreen = true;
var attributes = {};
attributes.id = "flashmo_template";
attributes.name = "flashmo_template";
swfobject.embedSWF("flashmo_246_black_pad.swf", "flashmo_template", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
swffit.fit("flashmo_template", 860, 700);
</script>

<!-- embedding SWF -->

the title file is locate in a folder called swfs and is named title.swf

thanks
Dialogist
zaxacongrejo wrote:
it dosent adjust position in resolution changes


It's not likely to adjust position when you change the resolution. See what happens is the user loads the swf, it gets loaded in memory (cache) and when you then change the resolution it'll keep what it already has. If you adjust the resolution, then clear the cache and reload the page, it may be different.

Most users aren't going to do that though, but most users aren't going to be loading it and then changing the resolution, either.

Code:

swfobject.embedSWF("flashmo_246_black_pad.swf", "flashmo_template", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
swffit.fit("flashmo_template", 860, 700);


^This part leaped out at me for obvious reasons.

There's 100%, 100% in the flash vars there and then

860, 700 in the swffit there.

It's supposed to embed at 860 (width) and 700 (height) is what this tells me. The right and left alignment problems then, are clearly due to the "100%", (width) conditional attributes in the flashvars above.

This sort of confused me (I can't see the flash itself) but I'm guessing that you have some sort of button to make this swf display in full screen mode? When you press that, you get the "100%," and that makes the title align off center to the left?

Try changing that part to:

Code:

swfobject.embedSWF("flashmo_246_black_pad.swf", "flashmo_template", "860", "700", "9.0.0", false, flashvars, params, attributes);
swffit.fit("flashmo_template", 860, 700);


If that doesn't work then I can't really do it blind folded and you'd better off linking me to the actual page that this is all on so that I can reproduce the error.
zaxacongrejo
hi yes i have a full screan button

but there are 2 swfs the main swf the one you speaking of is ok ,and auto adjusts to every resolution

the second swf is to be used as title it is a 3d animated title
i manage to make it work loading it with the AS


var Xpos:Number=60;
var Ypos:Number=5;
var swf:MovieClip;
var loader:Loader=new Loader();

var defaultSWF:URLRequest= new URLRequest("swfs/title.swf");

loader.load(defaultSWF);
loader.x=Xpos;
loader.y=Ypos;
addChild(loader);

and it worked, the title is there and it is in the righ position for me and avery 1024x700
resolutions
but imagine you are in a 1280 x800 screan you will not see that title centered, but aligned at the top left corner

what i want it to do is to be always centered no matter what resolution is beeing used

if i try to embed this title swf at the html i cant because the main swf its already there

so im a litle lost on this
zaxacongrejo
i made some progress changing the code to but now is not centered to 1027x760
lol

var Xpos:Number=60;
var Ypos:Number=5;
var swf:MovieClip;
var loader:Loader=new Loader();

var defaultSWF:URLRequest= new URLRequest("swfs/title.swf");

loader.load(defaultSWF);
loader.x= stage.stageWidth * 0.5;
loader.y= (stage.stageHeight - 510 ) * 0.5 - 60;
addChild(loader);
Dialogist
zaxacongrejo wrote:

but imagine you are in a 1280 x800 screan you will not see that title centered, but aligned at the top left corner


How about I imagine that you've posted a link so we can both stop imagining things.
zaxacongrejo
a link will not help you is not an embeded swf but a swf loaded with a loader
we arent talking about html but about AS 3
Dialogist
Good Lord...

Try embedding your flash "website" in a html page.

Rolling Eyes I'm not coming back until you learn how the internets work.
zaxacongrejo
Quote:

Good Lord...

Try embedding your flash "website" in a html page.

Rolling Eyes I'm not coming back until you learn how the internets work.




what? have said something wrong?

lol there are 2 swfs
swf n1 is the website
swf n2 is the title

swf n1 its there and everything is ok with the html
this swf n1 uses AS to load swf n2

what im looking for is help in the action script to center the title
Dialogist
I know there's two swfs. I know one is a loader. I know they use AS3. I know the problem lies in the allowfullscreen flashvars of the loader, and I know it is caused by the full screen button which switches between a hard coded attribute of width 860 and height 700 in the already posted code and the conditional 100% which is being called before it is causing this problem...

I knew (mindread) all of these things before I then had to physically go and do my own research tracing "flashmo_246_black_pad.swf" back to http://www.flashmo.com/ so I could download it from there to reproduce the (your) problem. Like I've asked you to (on your own behalf) twice. Still no link...



100% tells an swf to stretch itself to any of all possible dimensions. If a users screen was 1920x1080, it's going to fill that. If they have a VGA on their big screen tv, it's going to fill that too. If some reason, this free, pointless, candyass 1998 flash site ever ends up on a powerpoint projector in a lecture theatre...it's going to fill that too.

zaxacongrejo wrote:
what i want it to do is to be always centered no matter what resolution is beeing used


Ah but no fear of that, it's not going to fill any of their screens because it's sat on your computer and not embedding to 800 in the first place and nobody can take look at it but you.

zaxacongrejo wrote:
what? have said something wrong?


zaxacongrejo
let me tell you something english is not my first language
and im not looking for an argue but for help and im not a flash professional as you can see
i did tryed

swfobject.embedSWF("flashmo_246_black_pad.swf", "flashmo_template", "860", "700", "9.0.0", false, flashvars, params, attributes);
swffit.fit("flashmo_template", 860, 700);

but nothing changes


i also tryed params.allowfullscreen = true;


params.allowfullscreen = false;


but nothing changes

and them you tell me you had to go looking for the swf for yourself

hey i posted the html the name was there right?

but even having the template and telling me the problem is because of the full screan button

you didnt told me how shoud i fix it did you?

again im looking for help not for argues
zaxacongrejo
after read your post couple of times i did realise what you meant, and i did it but now im cofused
beacuse it worked ,the title is centered i removed the AS part of the code where the full screen was and it worked but the problem now is that the main website dosent adjust to the different resolutions
i tested with firefox and the title is always centered but not the main website in big resolution ex 1920x900 the website dosent fits the all screen insted i comes adjusted to the left
so i get ride of one problem and i end up in other one i dont know what to do because i dont know what is better what will look better

candyass 1998 flash site lol are you referring to the xhtml tag?

adobe only brought macromedia in 2004 or 05 not sure
Dialogist
So the template you downloaded had a title. It was a dynamic text box inside a movieclip. This stays centered in all resolutions and works perfectly. You've probably removed that and added your own. Am I right? You are loading this externally with actionscript and when you click on the fullscreen button, it is just doing exactly what you've told it to do.

Code:

var Xpos:Number=60;
var Ypos:Number=5;


And it's ending up in the top-left corner.

The reason it is doing this is because it's not being called into a movieclip. It's being called to the mainstage (more than likely by "swffit.fit").

So you need to retrace your steps back over until you had the desired functionality. The desired functionally was a title that aligns to the center all of the time, in all resolutions. It does that out of the box. You've dynamically loaded an external swf and this has caused the problem. How to fix?

"Borrow" the working functionality back from the original template. It has a movieclip with a dynamic text box nested inside of it with "Black Pad fluid layout" typed into it.



It has an instance of "header".

You would then click on that, "edit in place", delete that textbox and place your actionscript:

Code:

var Xpos:Number=60;
var Ypos:Number=5;
var swf:MovieClip;
var loader:Loader=new Loader();

var defaultSWF:URLRequest= new URLRequest("swfs/title.swf");

loader.load(defaultSWF);
loader.x=Xpos;
loader.y=Ypos;
addChild(loader);


On the first frame of the of the timeline inside that movieclip. Maybe set the x and y to 0.

Or better yet...

Code:

var swfLoader:Loader = new Loader();
 
var swfFile:URLRequest = new URLRequest("swfs/title.swf");
 
var container:MovieClip= new MovieClip();
 
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadedHandler);
 
function swfLoadedHandler(e:Event):void {
   trace("swf loaded");
}
 
swfLoader.load(swfFile);
 
container.addChild(swfLoader);

addChild(container);


The movieclip will resize to accomodate whatever you load into it - but more importantly - it will stay put. It will stay centered in all resolutions like theirs does.

Personally, I'm not sure why you are loading it dynamically in this way. Of course, the file size (you said it was animated title swf) is going to bigger and would add bloat to the main swf, but you're not preloading it either, so you may as well just stick it on the main stage.

Back in the days (Macromedia introduced Flash in '96 btw) I'd just put

Code:

loadMovie("swfs/title.swf", containerClip)


And have done with it. But this is why I don't use AS3. You need to create a movieclip dynamically to hold it, and an event listener and a request path.


The point is: Your externally loaded swf needs "trapping" in something on the mainstage (like a movie clip). For future reference, when something works before you break it, un-break it and learn why it worked in the first place. Then break it again properly.
zaxacongrejo
Hi unfortunately I just noticed now you post itís all here loll awesome.

I was already losing the hope on getting some help, great, really appreciated
I will have to read your post a couple of times to fully understand it, but I believe I can do it.
Let me tell you, and at the same time ask for some help, why I didnít noticed your post it is because the envelop icon thatís should be present at my list of post when someone comment disappeared none of them has icon so I donít know when people comment do you know how to solve this?
About the title itís a swf of 4mb its heavy I agree itís a 3d rotating tittle.
About the technique lol is the only one I know or have find I never been to IT schools of any kind I just do it, thatís why I usually find myself in trouble and then I have to annoy people for help loll
Very Happy
Dialogist
I would have fixed it for you myself if you'd have given me access to the files but that wouldn't have helped you any, anyway.

Helping you is advising you that...

zaxacongrejo wrote:

About the title itís a swf of 4mb its heavy I agree itís a 3d rotating tittle.


a 4mb flash file is too much to ask of your user's browser. The user will generally leave before it is loaded if their browser itself doesn't crash trying to cope with it. Also the user (in your eyes as a designer) should always be treated as a) a fool and b) poor. Designing for the stupid and designing for low res/low ram/deprecated systems usually please everyone.

Your 4mb flash file can be saved as a movie (from inside Flash itself). I'd go with an .mp4 (H.264 codec and AC3 audio). I'd then convert that to an .flv file (using quicktime if you're on a mac or Sorenson Squeeze if you're on a PC). You'll then have something between a 800k and 1mb flash video (depending on length and quality sacrifices) and that will be much easier to load. You could even embed it in the main flash file itself, making this entire thread redundant. But regardless of how you load or implement this file. Up to 1mb is always more welcomed than 4mb, unless you're Youtube or somebody, and have labs of international dedicated servers peddling your hamster wheels.
zaxacongrejo
Quote:
I would have fixed it for you myself if you'd have given me access to the files but that wouldn't have helped you any, anyway.


that doesnít help, guidance yes, because i will be learning

You are dam right thanks good you are helping me here

Quote:
Your 4mb flash file can be saved as a movie (from inside Flash itself).


The problem is that i did it 1 year ago and now i canít find the fla just the swf,
ok so obviously you are an expert letís just forget about the that title, so for that specific template what do you suggest me for a new title made from scratch ,I mean techniques what should I do?
Dialogist
I'm not an expert, I've just sat there longer, making more mistakes than most others. Your .swf can still be imported to a new flash file and exported out as a movie file. I'd try that first. If your flash won't import it, there's other tools (some freeware) that will convert your swf into mp4. If you're interested in making a new one, make it in after effects and have a look on video copilot for some pretty cool tutorials.
zaxacongrejo
If I convert it to mp4 in the best case will be around 800K to 1MB so the other .swf as 1,2MB
Staying at 2MB to 2.5MB is not too much right? is affordable?
Ide better staying with it

Quote:
swf can still be imported to a new flash flash and exported out as a movie file


Iíve tried now but you know is late my brain isnít working anymore not even near the 60%
I will try tomorrow
what I think I must do is to create a movie clip ,inside the new movie clip import to stage the title.swf , and then after saving export as a movie file right?
Dialogist
zaxacongrejo wrote:
If I convert it to mp4 in the best case will be around 800K to 1MB so the other .swf as 1,2MB
Staying at 2MB to 2.5MB is not too much right? is affordable?
Ide better staying with it

Quote:
swf can still be imported to a new flash flash and exported out as a movie file


Iíve tried now but you know is late my brain isnít working anymore not even near the 60%
I will try tomorrow
what I think I must do is to create a movie clip ,inside the new movie clip import to stage the title.swf , and then after saving export as a movie file right?


Just get some freeware and save yourself the headache. It might even let you go from swf to flv and save you a compression pass. Either way, an .flv is always going to be smaller than a swf.
zaxacongrejo
so the best method is to convert from swf to flv directly by alternative software?
Dialogist
Well I'm not sure if any programs/apps do that, and if they do, they'll probably perform a silent pass (swf (to mov) to flv) without telling you about it. It'll just end up in your tmp/temp files somewhere. That's where the audio editing apps hide their dirty laundry.

Honestly, you'll just have to have a mess around and see what can you figure out.

The best method for me is using Flash to export an swf to mov (Apple lossy "Animation" codec) and then Quicktime with Perian (on a mac) to export the mov to flv. Mpeg Streamclip is also an excellent (Free) movie convertor for mac and windows (it kind of sucks on windows a little bit more but that's because Quicktime (and its framework) on windows, sucks majorly).

The best method is always the one you feel comfortable with, that produces an adequate (or ideally "best") solution, for you personally. You're the one who is going to be doing it time after time and getting a work flow down and reliable will serve you well in the future.
zaxacongrejo
Iím not having any lucky, buy now Iíve tried 6 that claim to do it but they donít loll even online there are a few but i will keep digging i will find my way on this
Dialogist
zaxacongrejo wrote:
Iím not having any lucky, buy now Iíve tried 6 that claim to do it but they donít loll even online there are a few but i will keep digging i will find my way on this


Open Flash.

New document (AS2 or AS3, doesn't matter).

It's best to create a new (empty) movieclip but again, it doesn't really matter.

File > Import > Import to stage.

select your title swf and import it. It should appear in keyframes on the timeline.

File > Export > Export movie...

Save as type: Quicktime (*.mov), name it, hit save.

don't press export yet...

hit "Quicktime Settings"

Under "Video" hit the "Settings" button, and chose the "compression type" of "Animation". Hit "Ok".

If it uses transparency, select "Millions of colours +", if it does not use transparency, choose "Millions of colors".

Hit the "Size" button and select "Current". Hit "Ok".

Make sure sound is checked (if it uses sound), uncheck it if it does not. Leave "uncompressed" as the sound format, that's fine. Hit "OK".

Now press "Export".

------------------------------------------

You now have a lossless movie file of your swf.

Now you need to convert it to .flv.

Use one of the free programs you downloaded. They all do this. Quicktime will probably export it, depending on what version you have. With Flv files, the quality and bitrate increases the file size. A 10% reduction in quality usually cuts the filesize in half, and doesn't always leave poor results. But try a few experiments with the flv until you have a good ballance of smallest size vs best quality.

You can always try again and again because your movie you've just converted from the swf is lossless and will import into every movie editing app you can think of. Exporting it out as an flv can be done in most (some better than others, After Effects and the likes, don't do it very well). Quicktime (v.7) and especially Sorenson Squeeze (recommended) do it perfectly.
zaxacongrejo
hi im back when i try to play the .mov file at quicktime theres nothing there is it suposed to play the video?
Dialogist
zaxacongrejo wrote:
hi im back when i try to play the .mov file at quicktime theres nothing there is it suposed to play the video?


Of course it is. What codec did you export it with? Is the scrubber in Quicktime showing that the video is playing (but with a black screen)? Does it have a time counter indicating that it is playing? In Flash, did you place the imported swf inside a movieclip or straight on the mainstage? In Flash, did you allow Flash time to export and complete the exporting of the video (the confirmation dialogue pop up on a Mac actually looks like an error dialogue). Is there sound? Do you hear sound? Does it play in VLC (mac)? Windows Media Player (windows)? Honestly I don't even know what OS you are using. You have to provide more info to get more meaningful help.
zaxacongrejo
hi i had solved the problem but in other way, a better way yet
what I was facing,was I created a new movieclip them import to stage the swf ,and then I was able to see in the time line the frames but they were empty so I check the library and the bitmaps were there so exported the best bitmap renamed it and at the main fla I opened the header layer an convert it to symbol or something else no longer sure then I updated it with the renamed bitmap
Which solved me the problem in a better way because instead of a 4.5 MB title now I have just a 20 kb title not animated true, but it seems networks around the world still slow to download heavy sites, so better yet the all site is around 2.5 MB
i almost forgot to thank you for you help
Related topics
Does anyone know how to get your site to appear higher ?
Nightwish... does anyone like it?
Does anyone know.....
Does anyone play StarCraft?
Croatia in panic: Bird Flue knocks on the door!!!
Best Flash website
Does anyone use the new Joomla 1.1.x beta?
does anyone know the contact script and the comment pages
Does anyone know the Linksys Passphrase to WEP Key Algorithm
Does anyone use Swiftfox?
Does anyone know of a free gallery script?
Does anyone now how to make a website like this?
does anyone else once used this tools?
does anyone know about wow to build full 3d website ?
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Design Tips

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.