JavaScript Methods
sIFR provides a number of public methods, described here. Interaction with the Flash movie is also possible, see FlashInteractor.
activate(/* … */)
Activates sIFR if it is enabled, supported and on a valid domain.
setFlashClass()
Sets the CSS_HASFLASH class to the body element if it exists, otherwise to the document
element.
removeFlashClass()
Removes the CSS_HASFLASH class from the body and document element.
initialize()
Initializes sIFR. Should only be called if sIFR.registerEvents is false.
prefetch(/* … */)
Pre-fetch Flash movies. This stops unnecessary requests for Flash movies, makes sIFR load faster and saves bandwidth.
Arguments
This function can be called with multiple arguments, which have to be of the following types:
String- The URI of the Flash movie to pre-fetch.
Object- Object in the form of
{src: …}wheresrccan be an object, as described below, or a string, as described above. Object- Object in the form of
{'n': string}wherenis a Flash version andstringis as described above.
replace(kwargs, mergeKwargs)
Replaces elements with sIFR text.
Arguments
kwargs(Object)- A [keyword argument] object.
(optional) mergeKwargs(Object)- A [keyword argument] object. If present the properties
of
kwargswill be merged with this object.
Keyword arguments
elements(Array)- List of elements to be replaced. Useful if the elements
can't be selected by sIFR's
parseSelector, or if you wish to use a different selector parser. selector(String)- Selector which will be parsed by
parseSelector(if present). The selected elements will be replaced. Will not be used ifelementsis specified. css(Object)- CSS to be applied to the content of the Flash movie.
Specify the CSS in the form of
{'selector': {'property': 'value'}}. This is the preferred argument type. See also Styling. css(String)- CSS to be applied to the content of the Flash movie. See also Styling.
css(Array)- CSS to be applied to the content of the Flash movie. The array will be converted to a String and is then parsed as such. See also Styling.
filters(Object)- Filters to be applied to the Flash movie. See also Filters.
forceClear(Boolean)- As described in [sIFR.forceClear]. Overrides
sIFR.forceClear. fitExactly(Boolean)- As described in [sIFR.fitExactly]. Overrides
sIFR.fitExactly. forceWidth(Boolean)- As described in [sIFR.forceWidth]. Overrides
sIFR.forceWidth. tuneWidth(Number)- Positive or negative number which is added to the width of the Flash movie. This allows for tuning of the space surrounding the text.
tuneHeight(Number)- Positive or negative number which is added to the height of the Flash movie. This allows for tuning of the space surrounding the text.
offsetLeft(Number)- Positive or negative number which specifies the horizontal position of the text inside the Flash movie.
offsetTop(Number)- Positive or negative number which specifies the vertical position of the text inside the Flash movie.
wmode(String)- Specifies the window mode of the Flash movie. When
transparentthe movie will be transparent. Whenopaqueelements can be displayed on top of the movie. If transparency is not supportedwmodewill be set toopaqueand the background color specified in the CSS will be used. Therefore, it is important to always specify a background color! transparent(Boolean)- Equivalent to
wmode: 'transparent', if set totrue. opaque(Boolean)- Equivalent to
wmode: 'opaque', if set totrue. preventWrap(Boolean)- Tries to disable word wrap inside the Flash movie, but doesn't always work so well. Not the same as
forceSingeLine forceSingleLine(Boolean)- Forces the text to be displayed on a single line.
gridFitType(String)- See Livedoc 2747.
If the text is right aligned,
subpixelwill be used by default. Otherwisepixelwill be used. thickness(Number)- See Livedoc 2788.
sharpness(Number)- See Livedoc 2778.
blendMode(String)- See Livedoc 2444.
pixelFont(Boolean)- When
truerounds the font size to the nearest power of eight. This makes it possible to use bitmap fonts. ratios(Array)- Lets you help sIFR guess the height of the Flash movies, see Ratio Calculation
selectable(Boolean)- Disables text selection inside the Flash movie. Useful if you use a filter which Flash doesn't properly select.
modifyCss(Function)- Callback function which allows you to modify the CSS object.
For example, you can base the styles on the computed style of
elements you want to replace. The following properties however
need to be specified in the
cssargument:- leading
- background-color
- opacity
- blend-mode
- text-align
- text-transform
css(Object)- The CSS object which contains rules for rendering the Flash movie
contentNode(Element)- The element currently being replaced
selector(String)- The
selectorargument, if specified.
modifyContent(Function)- Callback function which allows you to modify the element being
replaced. This allows you to make specific changes before the
element is replaced with the Flash movie. It has no effect on
the alternate content. The callback function is called with
the following arguments:
contentNode(Element)- The element currently being replaced
selector(String)- The
selectorargument, if specified.
modifyContentString(Function)- Callback function which allows you to modify the HTML source
to be rendered in the Flash movie.
The callback function is called with the following arguments:
content(String)- The HTML source.
selector(String)- The
selectorargument, if specified.
onReplacement(Function)- Event handler which fires when an element has been replaced. It's argument is a FlashInteractor object
onRollOver(Function)- Event handler which fires when you move the mouse into a sIFR Flash movie. It's argument is a FlashInteractor object
onRollOut(Function)- Event handler which fires when you move the mouse out of a sIFR Flash movie. It's argument is a FlashInteractor object
onRelease(Function)- Event handler which fires when you click a sIFR Flash movie. Won't fire if
fixHoveris active. It's argument is a FlashInteractor object
getCallbackByFlashElement(node)
Returns a FlashInteractor object for the specified Flash element.
Arguments
node(HTMLObjectElement)- A reference to the Flash movie
<object>element.
redraw()
Re-inserts all sIFR Flash movies.

