Monthly Archives: April 2009

Adding .FLV MIME Type in IIS

.FLV files are already the best method for publishing video on the web, and are sure to become even better with the new enhancements in Flash 8. When serving .flv files off of a Windows Server 2003 (or any other Windows server I would imagine) requires setting up the MIME type on the server first (it isn’t one of the native MIME types on MS servers).

You can figure out easily if your server is configured to support .flv files by posting a .flv file on a server and navigating to the URL of that .flv in a browser. If you see a LONG string of garbage on the screen, your server isn’t set up for .FLVs and needs to have the MIME type set up.

Adding .flv MIME type in IIS

1) Select the site to configure in IIS, right click and select “Properties”
2) Under HTTP Headers Tab, select “File Types” under the MIME Map section and select “New Type”
3) Type “.flv” as the associated extension and “video/x-flv” as the content type.
4) Select “OK” and you’re ready to fly!

使Flex编译的swc文件在Flash下可用

一直不明白如何将很多的类编译成一个swc文件,并且在Flash里可用,就像Google Map Flash API一样,今天终于找到了。http://vincent.the.tsao.googlepages.com/ 这篇文章有很详细的说明。现转于此:

Last updated: 24-August-2008

Problem

Many API’s or code libraries written in ActionScript 3 and compiled into SWC files are meant for use with Flex tools and are unable to be imported into the Flash CS3 Authoring Environment.  This tutorial will show you how you can (theoretically) take any SWC made for Flex and use it in Flash CS3.

Resources

You will need the following programs/tools:

  • Flash CS3
  • Flex SDK 2.0.1 with Hotfix 3

(note that we are intentionally NOT using Flex SDK 3.0)

You can get Flex SDK 2.0.1 with Hotfix 3 here:
http://labs.adobe.com/technologies/flex/sdk/flex2sdk.html

Explanation

If you just want the steps, you can skip down to the next section, but this describes why the method works.  When we say “Flex SWC”, what we really mean is a code-only SWC file which contains no DisplayObject components.  Only SWC files with a DisplayObject component can be imported into the Flash CS3 Authoring Environment.  Thus in order to make a Flex SWC usable in Flash CS3, we use the Flex SDK’s compc tool to statically link it with a stub SWC file generated in Flash CS3 that is a DisplayObject.  We require the Flex SDK 2.0.1 Hotfix 3 version of compc because Flex SDK 3.0’s compc utility generates SWC files of version 1.2 and Flash CS3 can only use SWC files of version 1.0.  More over, earlier versions of the Flex SDK 2.0.1 compc utility could not read SWC files compiled by the Flash CS3 authoring environment, thus the need for Hotfix 3.  So the newly compiled SWC file is actually two SWC files put into one – a DisplayObject SWC and the original Flex SWC and can therefore be used within Flash CS3.

Steps

Part I: Creating a Stub DisplayObject SWC in Flash CS3

  1. Create a new ActionScript 3 FLA file in Flash CS3.
  2. Create a new symbol in the library (you do not need to create an instance of it), name it whatever you want.
  3. Go into your library and right click on the symbol you just created.  Select “Component Definition…”
  4. Type in whatever you want your component to be called as the class name (no spaces).
  5. Under the options part, check all the boxes and ensure the minimum Flash Player is 9 and the minimum ActionScript version is 3.
  6. Leave everything else alone, press OK.
  7. Right click the symbol again in your library and select and select “Linkage…”
  8. Check the “Export for ActionScript” box and the “Export in first frame” box should be automatically checked as well.
  9. The class name should be the same name you gave it earlier.
  10. Ensure the base class is indeed MovieClip, click OK.
  11. Right click the symbol again in your library and select “Export SWC File…”
  12. Pick a place to save it.

Part II: Putting the two SWC Files Together

  1. Use the compc program to wrap what you have just created with the Flex SWC you want to use in the Flash CS3 authoring environment.  Here is a simple example:compc -source-path+=. -output=bin\map_flash_1_6.swc -include-libraries=.\GoogleMapsFlashAPI.swc,.\map_flex_1_6.swcNote the above command is all on one line (no line breaks). The file “map_flash_1_6.swc” is the name we choose for the component we output. “GoogleMapsFlashAPI.swc” is the name of the SWC we created in Flash CS3 in Step 1 and “map_flex_1_6.swc” is the SWC you want to be able to use in Flash CS3.
  2. Place your newly generated SWC file in your Flash components folder. It should be something like “\Adobe Flash CS3\en\Configuration\Components\”. If you are unsure where this is located on your computer, Google it.
  3. Open the FLA file you want to import the SWC into and open the Components panel (Ctrl+F7 in Windows).
  4. Reload the Components panel if necessary.
  5. Drag your SWC file into your library (note: that there does NOT need to be an instance of the SWC on your stage since it would be useless).

Please let me know if this does not work.
My contact is vincent.the.tsao [–at–] gmail [–dot–] com

HTML版本引起的object标签显示问题

CSS部分:

body
{
margin: 0px;
padding: 0px;
}
object
{
margin: 0px;
padding: 0px;
}
table, tr, td
{
padding: 0px;
margin: 0px;
border: 0px;
}
iframe
{
margin: 0px;
padding: 0px;
}
#body.day
{
background: #F0FF00;
}
#body.night
{
background: #000000 url(“images/night_Scene_body.jpg”) repeat;
}

BODY的内容:

<table style=”background-color: Black;” border=”0″ cellpadding=”0″ cellspacing=”0″
width=”100%”>
<tr>
<td>
<object style=”visibility: visible;” id=”bg_left” data=”night_WhoScene_bg_side.swf”
type=”application/x-shockwave-flash” height=”600″ width=”100″>
<param value=”exactfit” name=”scale”/>
<param value=”window” name=”wmode”/>
<param value=”false” name=”allowfullscreen”/>
</object>
</td>
</tr>
</table><div>
<object style=”visibility: visible;” id=”bg_bottom” data=”night_WhoScene_bg_bottom.swf”
type=”application/x-shockwave-flash” height=”40″ width=”1280″>
<param value=”exactfit” name=”scale”/>
<param value=”window” name=”wmode”/>
<param value=”false” name=”allowfullscreen”/>
</object></div>

对于IE7,显示时上面一个swf跟下面一个中间是没有间隙的,而对于ie8,firefox3,chrome1,显示时,两个flash中间都出现的间隙,整了一整天,也不知道为什么,最后发现在将html头部的

<!DOCTYPE HTML PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>改成

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

问题竟然解决了,晕哦,但是要真想在 XHTML 1.0 Strict 下正常显示中间无缝隙该怎么做呢?

Javascript 获取窗口宽度和高度值

获取页面高度,窗口高度,滚动条高度等参数值:

  1. function getPageScroll(){
  2. var yScroll;
  3. if (self.pageYOffset) {
  4. yScroll = self.pageYOffset;
  5. } else if (document.documentElement && document.documentElement.scrollTop){   // Explorer 6 Strict
  6. yScroll = document.documentElement.scrollTop;
  7. } else if (document.body) {// all other Explorers
  8. yScroll = document.body.scrollTop;
  9. }
  10. arrayPageScroll = new Array(”,yScroll)
  11. return arrayPageScroll;
  12. }
  13. function getPageSize(){
  14. var xScroll, yScroll;
  15. if (window.innerHeight && window.scrollMaxY) {
  16. xScroll = document.body.scrollWidth;
  17. yScroll = window.innerHeight + window.scrollMaxY;
  18. } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
  19. xScroll = document.body.scrollWidth;
  20. yScroll = document.body.scrollHeight;
  21. } else { // Explorer Mac…would also work in Explorer 6 Strict, Mozilla and Safari
  22. xScroll = document.body.offsetWidth;
  23. yScroll = document.body.offsetHeight;
  24. }
  25. var windowWidth, windowHeight;
  26. if (self.innerHeight) {  // all except Explorer
  27. windowWidth = self.innerWidth;
  28. windowHeight = self.innerHeight;
  29. } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
  30. windowWidth = document.documentElement.clientWidth;
  31. windowHeight = document.documentElement.clientHeight;
  32. } else if (document.body) { // other Explorers
  33. windowWidth = document.body.clientWidth;
  34. windowHeight = document.body.clientHeight;
  35. }
  36. // for small pages with total height less then height of the viewport
  37. if(yScroll < windowHeight){
  38. pageHeight = windowHeight;
  39. } else {
  40. pageHeight = yScroll;
  41. }
  42. if(xScroll < windowWidth){
  43. pageWidth = windowWidth;
  44. } else {
  45. pageWidth = xScroll;
  46. }
  47. arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
  48. return arrayPageSize;
  49. }