GithubHelp home page GithubHelp logo

liquidmelon / adapt-component-animateccmate Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 54 KB

a component which embeds Adobe Animate CC content into an object

License: GNU General Public License v3.0

JavaScript 77.58% HTML 21.01% CSS 1.41%

adapt-component-animateccmate's Introduction

adapt-component-animateCCmate

animate CC mate is a presentation component for the Adapt framework that allows you to embed responsive HTML5 content created with Adobe Animate CC into your course. the content must be completed in order to complete the component.

animate CC mate is based on the Game Frame plugin, but uses a custom event to initiate the communication. iframes were strictly avoided in consideration of ios.

Setting up an animate CC file

here is the code* used to handle the communication between adapt and the animate cc object. the animate cc object initiates the communication by sending a custom event to window.parent which is adapt's course window. the window listener in component's code is then able to set a reference to the animate cc object. the component passes a reference to itself when calling a function in the animate cc object. once they have a reference to each other, passing data back and forth is easy.

*code is from an Animate CC .fla file, which was published as HTML5 content. the .fla requires a dynamic text field (myTxt) and a button (myButt) on it's stage. the published example is included in the skeleton directory.

////////////////////////////////////
//set up the two-way communication

var t = this;
var myAdapt;

this.canConnect = function(tRef,dRef){

  console.log("component _isComplete: " + tRef.model.get('_isComplete') + " / done: " + dRef);

  myAdapt = tRef;

  var val = myAdapt.getObjectValue("_isComplete");
  console.log("val: " + val);

  if(Boolean(val)){
    t.myTxt.text = "! completed !";
    t.myButt.visible = false;
  }
  else{
    t.myTxt.text = "not completed";
  }

}

var myLoadEvent = new CustomEvent('myLOAD', { 'detail': t });
window.parent.dispatchEvent(myLoadEvent);

////////////////////////////////////
// do some stuff

this.myButt.addEventListener("click", completeMe.bind(this));

function completeMe(){

  console.log("completeMe");

  //

  myAdapt.isDone();

  var val = myAdapt.getObjectValue("_isComplete");
  console.log("val: " + val);

  if(Boolean(val)){
    t.myTxt.text = "! completed !";
    t.myButt.visible = false;
  }

}

Notes

when using the default source path and included example after installing this plugin, be sure to check the plugin assets directory in the build of a course. you may have to move the contents of the skeleton directory back into the skeleton directory. use the skeleton's directory structure in the repo as a guide.

you can also move the skeleton directory to the course assets directory. if you do, be sure to change the source path to "course/en/assets/skeleton/skeleton.html". (this is the preferred method for production)

also note that this plugin is more for reference than for production. it is suggested to make a fork to support your own scenario. knowledge of animate cc will be helpful.

Reference Links

Creating and triggering events

Limitations

not known at this time


Version number: 0.0.1.1
Framework versions: ^2.0.0

adapt-component-animateccmate's People

Contributors

liquidmelon avatar

Stargazers

Dan Gray avatar

Watchers

James Cloos avatar

Forkers

mldaq

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.