Web And Videogame Development

Adding A Border To A Flash Object

Posted: January 16th, 2009 | Author: | Filed under: Flash, Notes | Tags: | 1 Comment »

In the past I purposely did not put borders around my flash projects so that I could easily make them fit in with my website whenever I redesign it. The idea was that it would be easy enough to add a border using CSS… but that did not work out well. So I just embedded the files without a border, which made it hard to tell where the .swf begun and where it ended if I used a white background. Recently however I took another go at it and was successful, the trick was to add display: inline-block; to it.

.flashBorder {
	padding: 2px;
	border: 1px solid #CCCCCC;
	display: inline-block;
}
<div class="flashBorder">
	<object width="400" height="300">
	<param name="movie" value="yourProject.swf">
	<embed src="yourProject.swf" width="400" height="300">
	</embed>
	</object>
</div>

Without adding disply: inline-block;, my div borders would expand as far as possible instead of hugging closely around the flash object. The only way I could find around it was specifying the div width and height for each flash object that needed a border.


One Comment on “Adding A Border To A Flash Object”

  1. 1 Jake said at 9:42 am on August 18th, 2009:

    Thank you so much. I looked everywhere for this piece of code and nobody else seemed to be doing what I wanted. Thank you.


Leave a Reply