headacheCoder
headacheCoder

Reputation: 4613

SWF object params - scale or scaleMode

In my job I'm embedding SWF files into HTML documents all the time. I often asked myself a few things:

Is it scaleMode="noscale" or scale="noscale"? And are the values case-sensitive? I saw a few code snippets like scale="noScale" etc.

How is the syntax in ActionScript? Is it the Camelcase noScale? I don't care about the HTML standards I'd just like to know how it is from the Flash developers perspective.

Anyone has a clue? I checked Google a lot of times but I have never found something like a conformance description. I just found the Adobe page that describes the parameters and values but that does not answer any of my questions.

Thanks a lot! :)

Upvotes: 3

Views: 41706

Answers (2)

pipwerks
pipwerks

Reputation: 4581

If you're setting your scale mode via ActionScript, you use the scaleMode property of the Stage object. If you're setting it via JavaScript or HTML markup, you use scale in a <param> node.

Regarding capitalization, Adobe's documentation for scaleMode (ActionScript) has used camel case consistently for as long as I can remember (at least the last 6 years). The current AS3 docs clearly use camel case. The article linked above is referring to scale in JavaScript/HTML, not ActionScript. It seems that camel case across-the-board is the safest route, you can be sure it will be supported.

Here are some scale examples using using SWFObject:

SWFObject dynamic:

var flashvars = {};
var params = { scale: "noScale" };
var attributes = {};
swfobject.embedSWF("/swf/sample.swf", "flash", "100%", "100%", "9", false, flashvars, params, attributes);

SWFObject static:

<object id="flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%">
  <param name="movie" value="/swf/sample.swf" />
  <param name="scale" value="noScale" />
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="/swf/sample.swf" width="100%" height="100%">
  <param name="scale" value="noScale" />
  <!--<![endif]-->
    <p>Place fallback content here for users who don't have Flash<p>
  <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>

Examples and a description of the scale options:

http://learnswfobject.com/advanced-topics/100-width-and-height-in-browser/

Upvotes: 2

package
package

Reputation: 4801

Found answer in Google in 3 seconds:

scale - Possible values: showall, noborder, exactfit, noscale. Specifies how Flash Player scales SWF content to fit the pixel area specified by the OBJECT or EMBED tag. default (Show all) makes the entire SWF file visible in the specified area without distortion, while maintaining the original aspect ratio of the movie. Borders can appear on two sides of the movie. noborder scales the SWF file to fill the specified area, while maintaining the original aspect ratio of the file. Flash Player can crop the content, but no distortion occurs. exactfit makes the entire SWF file visible in the specified area without trying to preserve the original aspect ratio. Distortion can occur. noscale prevents the SWF file from scaling to fit the area of the OBJECT or EMBED tag. Cropping can occur.

More info here

Edit: I think case-sensitivity depends on the browser, but following xhtml standards you should always use lowercase.

Edit2: scaleMode on the other hand is a property of Stage object in ActionScript, so it is used to set scale mode in SWF movie, that is not embeded. When you embed the swf, that param is overriden with what you've set up in your HTML.

Upvotes: 9

Related Questions