When you install flash node it provides a new input filter. By enabling the filter as part of an input format you can you re-use content from a flash node in other nodes by using a "macro". By using flash node macros you can, for example, use the same flash material in several nodes, fine tune exactly where the flash appears in a node, and you can also use it as a quick way to add flash content to a block.

Macros are written in the format [flashnode|nid=<nid>] and placed in the body. You can pass optional parameters to manipulate the display of the Flash content by including them in the macro.

Parameters that can be used in a flash node macro are as follows:

  • width - set a specific width, in pixels
  • height - set a specific height, in pixels
  • scale - scale both width and height to a multiple of the original size
  • xscale - scale just the width to a multiple of the original size
  • yscale - scale just the height to a multiple of the original size
  • scalewidth - set a specific width, in pixels, and automatically adjust the height to maintain the aspect ratio
  • scaleheight - set a specific height, in pixels, and automatically adjust the width to maintain the aspect ratio
  • flashvars - set a Flashvars string to pass to the Flash movie

For example, to use content from a flash node with node number 10, scaled to 50% of its original size, you would use [flashnode|nid=10|scale=0.5]

You can refer to "unpublished" flash nodes using the macro. So if node 10 in the example above were unpublished it would still be displayed in other nodes that use a macro. This is intentional and is designed to let you create "placeholder" content that shouldn't be viewed in its own right and is only meant to be referred to by other nodes. You might use this technique to add a flash item to a block. You don't want the flash node itself to be visible, you only refer to it from a macro in a block.

If the flash node has flashvars associated with it then these will be passed to the macro, unless they are over-ridden by the macro specifying a new set of flashvars. If the flashvars of the original node are generated by PHP then the PHP code will be still be processed in other nodes. However, if you over-ride the flashvars in the macro in the new node then you can only use the input format of the new node. This is to prevent users gaining access to PHP via the flash node macro.

Note - if the nid that you use in the macro isn't a flash node then the macro will generate an error message.

You can see an example of content being generated with a flash node macro on my website.

Flash node macros with flv or mp3 content

If you use a flash node macro to refer to a node that contains flv or mp3 content AND you want to scale the player or resize it then you must assign an explicit height and width in the intial flash node. If you don't do this then SWF Tools will render the media player at its default size irrespective of the scale setting you specify in the macro. This happens because SWF Tools is called AFTER flash node, and if flash node has no size data SWF Tools will revert to defaults. By providing an explicit size in the original flash node the scaling function will be applied and SWF Tools will respect the resulting height and width.

Don't forget to enable the macro filter!

By default flash node macros are not enabled for any input format and they must be assigned to ones where you want to use them.

Go to Administer > Site configuration > Input formats to see the list of input formats. Click configure for the format you want to add the filter to. Next, place a check next to Flash node filter. Finally, click Save configuration.

Flash node macros will now work for that input format. If you find that the filter clashes with another you might need to play around with the weights. To do this click on the Rearrange tab after activating the filter. The flash node filter generally works best when it comes last in the list as other filters might otherwise change its code and break your flash!

Comments

frankloydknight’s picture

How about relaxing the numeric restriction for the width?
You can specify a percentage of the container size as the width, if your swf is coded to expand to take advantage of that then you might want to use "100%".