Center an image in Flash?

Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Center an image in Flash?

Post by JAB Creations »

This seems like it should make sense...I have a 32x32 Flash object with a 32x32 image inside set to display at 0.0 (x.y) and is present on all frames in the movie. Why then does the published SWF not display the image? It's a lossless GIF image and the Flash version required is Flash 6 (good support for older operating systems).
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

Also when the file is played in regular Flash player (directly through XP, not the browser) the image does appear fine).

I just tried putting the image on a different layer (hiding and showing the other layer and making sure I get Flash's z-index correct) and I'm still having this issue? :roll:
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

Removing embed element disables the image...why?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

Solution: The code on this site works without the embed element and displays the image...
http://www.dgx.cz/trine/item/how-to-cor ... into-xhtml

I am unaware of what the difference is between the XHTML I was using and this, but it works. If anyone has the same problem with Flash not displaying the image (or you initially think it's not being centered like I did) use the code below...

Quoted XHTML...

Code: Select all

<!--[if !IE]> -->
<object type="application/x-shockwave-flash"
  data="movie.swf" width="300" height="135">
<!-- <![endif]-->

<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
  width="300" height="135">
  <param name="movie" value="movie.swf" />
<!--><!---->
  <param name="loop" value="true" />
  <param name="menu" value="false" />

  <p>This is <strong>alternative</strong> content.</p>
</object>
<!-- <![endif]-->
User avatar
gregwhitworth
Forum Commoner
Posts: 53
Joined: Tue Oct 09, 2007 1:00 am
Location: Wasilla, Alaska

Post by gregwhitworth »

I'm not fully understanding your issue, but it seems as though you are only using 1 browser to check your work as your fix is an IE hack; because IE goes on their own little rabbit trail on how to make things appear in a browser. I would highly recommend downloading Firefox and testing your sites in both browsers, as you need to make sure that your site is consistent universally, not just on the more popular browser.

Also, had you checked it in Firefox, you would have seen that your Flash was perfectly fine and the fault was with IE.

Good Luck and keep up the hard work,

Greg
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

Thanks for the reply Greg. I have since determined that Flash has somehow become corrupted to the point of having to reinstall XP sometime in the somewhat near future. While the odd code I posted worked fine on a second computer I'll probably revert back to my original which I knew worked just fine. Strange the uninstaller for Flash didn't truly uninstall, new profiles for Gecko browsers, etc. I'm just going to reinstall XP soon. Thanks again for your reply and welcome to the forums. :)
Post Reply