Documentation
Swiffy Animation
Description
This module allows users to embed animations and other projects created in Adobe Flash and converted with the Google Swiffy plugin.
Note: This module uses Google Swiffy to play animations converted from Adobe Flash. Both Flash Player (EOL Dec 2020) and Swiffy (discontinued 2016) are obsolete technologies and are no longer supported by modern browsers. This module should not be used for new content creation. It is documented here only for reference regarding existing legacy content.
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 |
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 the 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 the setVars command of the module. The Flash project needs to be prepared before being exported to Swiffy by adding 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 the getURL method available in ActionScript 2 and 3 that redirects a page or calls a JavaScript 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 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.