PDA

View Full Version : Positioning Embedded Flash Files with CSS



FrankieB
May 2nd, 2006, 08:40 PM
Hey there fella's

I am trying to rack my brain trying to figure out how to do this. Lets say I have a named Flash file on my page, placed with just the embed tag in the code. I want to position the Flash movie based on its name, not the entire embed tag. This works for me:


<html>
<head>
<title>Nice</title>
<style type="text/css">
embed {left: 50px; margin-left: 450px; }
</style>
</head>

<body>
<embed src="kB.swf" width="300" height="50" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="joe" ></embed>
</body>
</html>


It moves my Flash movie over towards the right of the page. Excellent!

Except when I have 2 Flash movies on the page they both move. I do not want this.

Is there a way to have the CSS tell a particular named Flash movie where to go, in this case, joe?

I'd really appreciate any help. I know this probably seems like a ******* question but I will explain my reasoning if need be.

CriTiCeRz
May 2nd, 2006, 08:45 PM
Ok you have to make a style for each.



#flash1 {
margin-left: 450px;
left: 50px;
}
#flash2 {
margin-right: 20px;
right: 60px;
}

You have to make a ID/CLASS for each. Then you apply it like this:

<embed src="kB.swf" width="300" height="50" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="joe" id="flash1"></embed>

And you change the ID/CLASS to what ever you put it on in the CSS. I think you can put style to most of the things on a website. :) Hope I helped.

FrankieB
May 2nd, 2006, 08:51 PM
Ok I figured this would come up.

Is there a way to do it by just pointing to what it's named?

CriTiCeRz
May 2nd, 2006, 09:09 PM
Ummm... Not that I know of. You can put the style in the same embed tag if you want though...

FrankieB
May 2nd, 2006, 09:12 PM
Well, what I am doing is on Myspace. I customize my page so it doesn't look like a normal Myspace page, and they have these Flash players that play music that you can have on your profile. They don't have an ID or class, they are just named. That and they generate on profile view so its not like something I can just drop in there.

Oh well. Thanks anyway man.

CriTiCeRz
May 2nd, 2006, 09:18 PM
Mmmmh... Sorry, but I haven't messed with my Myspace page yet. I don't know if you can change that Flash Music Player, since Myspace gives it to you. Why don't you make your own? Or ask someone for one?

Ankou
May 2nd, 2006, 09:26 PM
JavaScript has getElementByName() but I'm not sure about the browser support. You could use that and then style the element to position it where you wanted.

FrankieB
May 2nd, 2006, 09:26 PM
I can make my own. I actually have already made one. I just thought it might be easier for myself and other people looking at my Myspace to stop the music and what not if they choose.

FrankieB
May 2nd, 2006, 09:27 PM
JavaScript has getElementByName() but I'm not sure about the browser support. You could use that and then style the element to position it where you wanted.

I thought about that too but Myspace doesn't allow Javascript besides what they already have. Lame.

mikkomikko
May 3rd, 2006, 01:32 AM
embed[name=joe] {left: 50px; margin-left: 450px; }

That way you can position embed named joe. Doesn't work in ie though. That is just very sad.:*(