Last active
January 3, 2019 07:11
-
-
Save jhiswin/22c62ea2f3428f3f0236 to your computer and use it in GitHub Desktop.
utilities for swiffy runtime, so it's easier to manipulate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
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(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment