Documentation

Swiffy Animation

Description

This module allows users to embed animations and other projects created in Adobe Flash and converted with Google Swiffy plugin.

Properties

The list starts with the common properties. Learn more about them by visiting the Modules description section. The other available properties are described below.

Property name Description
Animations
  • Swiffy File - a file generated by Google Swiffy plugin for Adobe Flash. This file needs to be modified as described below before uploading it.
  • Auto Play - if this property is disabled, the module will wait for the "start()" command from the Advanced Connector or any other module capable of executing commands, such as e.g. the Double State Button. Otherwise, the animation will be loaded and started automatically.
  • Disable Transparent Background - the animation background is transparent by default. If you wish to use the background color from the Flash's Stage, enable this option.
  • Do Not Preload - mark it if you do not wish for the asset to be preloaded.

This property allows online resources. Find out more »

Initial Animation The item number of the initially displayed animation.

Swiffy HTML file modification

A file generated by Google swiffy contains the entire HTML structure. What needs to be sent to the module is only the contents of the "script" tag that has the definition of swiffyobject variable. You need to simply open the file in a text editor such as Notepad and remove everything except for the part beginning with "swiffyobject = {"tags":(...)” etc. and ending with a semicolon. All contents of a properly modified file should look like this:

swiffyobject = {"tags":[{"type":9,"actions":[{"constants": (…)
(...)
"frameCount":140,"frameRate":25,"version":11};

Supported commands

Command name Params Description
hide --- Hides the module if it is visible.
show --- Shows the module if it is hidden.
switchAnimation item Changes the visible animation to the one with the item number provided as a parameter.
start item If the animation has the 'Auto Play' parameter disabled, it waits for this command to start.
replay item Destroys the swiffy object of the current animation (or the one which item number is provided), creates it again, and then starts the animation.
setVars commands Sets swiffy's representation of "Flash variables". The parameter must be a string containing two words separated by a comma, e.g. setVars("action,play");. The first word is the variable name, and the second is its value.

Controlling the animation

The only way to control swiffy animations is to use their setFlashVars method represented by setVars command of the module. Flash project needs to be prepared before being exported to swiffy by adding a code in ActionScript to the main timeline, e.g.:

_root.onEnterFrame = function(){
switch(_level0.myresponse){
case 'play':
_root.play();
break;

case 'pause':
_root.stop();
break;

default :
break;
}
_level0.myresponse = undefined;
}

Then by using the following code, e.g. in the Single State Button, we can stop the animation at any time by pressing the button:

SwiffyAnimation1.setVars("myresponse,pause");

Warning

In your Adobe Flash/Animate projects please do not use getURL method available in ActionScript 2 and 3 that redirects a page or calls a javasctipt method or code. In some cases, this causes problems with communication between the website and the iframe containing the lesson.

If you wish to call the javascript function from inside of the Swiffy animation, please use the ActionScript's ExternalInterface object. This is an example in ActionScript 2.0:

flash.external.ExternalInterface.call("player.getPlayerServices().getModule('Image1').hide()");

Events

The Swiffy Animation module does not send events.

CSS classes

Class name Description
.swiffyContainer Main class containing the entire module's content.

Styles from a sample presentation

.SwiffyAnimation_test { background: #ffffff; border: 1px solid #bbbbbb; overflow: hidden; padding: 2px; }

Demo presentation

Demo presentation contains examples of how to use the Swiffy Animation module.