I have a locally stored edge animation named index.html
with 5 animated slides in an iOS app. I am loading this html in a UIWebView and looking for a way to send a message to the edge animation to display a specific slide in the WebView. How can I achieve this?
The JavaScript file associated with this is called index_edgeActions.js
. Below is the code snippet:
//Edge symbol: 'Nav_Bar'
(function(symbolName) {
Symbol.bindElementAction(compId, symbolName, "${_go_to_slide}", "click", function(sym, e) {
var myPos = sym.getComposition().getStage().getPosition();
var myTimeline = sym.getComposition().getStage();
var x = document.getElementById("txt").value;
// Code logic to play different slide based on input value
// ...
if (x == 28) {
$(function() {
if (myPos < 14000) {
myTimeline.play(13501);
}
});
} else {
alert("Only Slides From 1-28");
}
});
Additionally, here is how you can use this code in Xcode Action:
NSString* javascriptCommand = [NSString stringWithFormat:@"index_edgeActions.js"];
[webview stringByEvaluatingJavaScriptFromString:javascriptCommand];
[hema stringByEvaluatingJavaScriptFromString:@"getElementById(12)"]