Skip to content

Instantly share code, notes, and snippets.

@jhiswin
Last active January 3, 2019 07:11

Revisions

  1. jhiswin revised this gist Nov 7, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions swiffy_utilities.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    // TODO make this not an ugly hack, assumes a lot of things
    // TODO add a LoadMovie to load movie in-place, need to retrieve bgcolor and frameSize and set them

    // for swiffy v7.4

    // loadMovie only works if ends in lowercase .swf, looks for .swf.json
    function lcase_swf(path) {
    var path = path[path.length - 4] === '.' ? path.slice(0, -4) : path;
  2. jhiswin revised this gist Nov 6, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions swiffy_utilities.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    // TODO make this not an ugly hack, assumes a lot of things
    // TODO add a LoadMovie to load movie in-place, need to retrieve bgcolor and frameSize and set them

    // loadMovie only works if ends in lowercase .swf, looks for .swf.json
    function lcase_swf(path) {
    var path = path[path.length - 4] === '.' ? path.slice(0, -4) : path;
  3. jhiswin created this gist Nov 6, 2015.
    36 changes: 36 additions & 0 deletions swiffy_utilities.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    // loadMovie only works if ends in lowercase .swf, looks for .swf.json
    function lcase_swf(path) {
    var path = path[path.length - 4] === '.' ? path.slice(0, -4) : path;
    return path + '.swf';
    }

    swiffy.Stage.prototype.getContainer = function () {
    return this['Td'];
    };
    swiffy.Stage.prototype.getRoot = function () {
    return this['Ga']['O']['s'];
    };
    swiffy.Stage.prototype.GoToFrame = function (n) {
    this.getRoot().stop();
    this.getRoot().gotoAndStop(n + 1);
    };
    swiffy.Stage.prototype.Rewind = function () {
    this.getRoot().stop();
    this.getRoot().gotoAndStop(1);
    };
    swiffy.Stage.prototype.GetMovie = function () {
    this.__url__;
    };
    swiffy.Stage.prototype.SetMovie = function (url) {
    url = lcase_swf(url);
    if (this.__url__ === url) return url;
    this.__url__ = url;
    this.setSwfUrl(url);
    this.getRoot().loadMovie(url);
    return url;
    };
    swiffy.Stage.prototype.PlayMovie = function () {
    this.start();
    this.getRoot().stop();
    this.getRoot().play();
    };