1

I have an edge animation called index.html (5 animated slides ) locally stored in iOS app. I load that html in a UIWebView, and I want to send message to the edge animation to show specific slide in the WebView. How do I do this?

My JavaScript file is named index_edgeActions.js. This is the code:

//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;
        if (x == 1) {
            $(function() {
                if (myPos > 500) {
                    myTimeline.playReverse(999);
                }
                if (myPos < 500) {
                    myTimeline.play(1);
                }
            });
        } else if (x == 2) {
            $(function() {
                if (myPos > 1000) {
                    myTimeline.playReverse(1499);
                }
                if (myPos < 1000) {
                    myTimeline.play(501);
                }
            });
        } else if (x == 3) {
            $(function() {
                if (myPos > 1500) {
                    myTimeline.playReverse(1999);
                }
                if (myPos < 1500) {
                    myTimeline.play(1001);
                }
            });
        } else if (x == 4) {
            $(function() {
                if (myPos > 2000) {
                    myTimeline.playReverse(2499);
                }
                if (myPos < 2000) {
                    myTimeline.play(1501);
                }
            });
        } else if (x == 5) {
            $(function() {
                if (myPos > 2500) {
                    myTimeline.playReverse(2999);
                }
                if (myPos < 2500) {
                    myTimeline.play(2001);
                }
            });
        } else if (x == 6) {
            $(function() {
                if (myPos > 3000) {
                    myTimeline.playReverse(3499);
                }
                if (myPos < 3000) {
                    myTimeline.play(2501);
                }
            });
        } else if (x == 7) {
            $(function() {
                if (myPos > 3500) {
                    myTimeline.playReverse(3999);
                }
                if (myPos < 3500) {
                    myTimeline.play(3001);
                }
            });
        } else if (x == 8) {
            $(function() {
                if (myPos > 4000) {
                    myTimeline.playReverse(4499);
                }
                if (myPos < 4000) {
                    myTimeline.play(3501);
                }
            });
        } else if (x == 9) {
            $(function() {
                if (myPos > 4500) {
                    myTimeline.playReverse(4999);
                }
                if (myPos < 4500) {
                    myTimeline.play(4001);
                }
            });
        } else if (x == 10) {
            $(function() {
                if (myPos > 5000) {
                    myTimeline.playReverse(5499);
                }
                if (myPos < 5000) {
                    myTimeline.play(4501);
                }
            });
        } else if (x == 11) {
            $(function() {
                if (myPos > 5500) {
                    myTimeline.playReverse(5999);
                }
                if (myPos < 5500) {
                    myTimeline.play(5001);
                }
            });
        } else if (x == 12) {
            $(function() {
                if (myPos > 6000) {
                    myTimeline.playReverse(6499);
                }
                if (myPos < 6000) {
                    myTimeline.play(5501);
                }
            });
        } else if (x == 13) {
            $(function() {
                if (myPos > 6500) {
                    myTimeline.playReverse(6999);
                }
                if (myPos < 6500) {
                    myTimeline.play(6001);
                }
            });
        } else if (x == 14) {
            $(function() {
                if (myPos > 7000) {
                    myTimeline.playReverse(7499);
                }
                if (myPos < 7000) {
                    myTimeline.play(6501);
                }
            });
        } else if (x == 15) {
            $(function() {
                if (myPos > 7500) {
                    myTimeline.playReverse(7999);
                }
                if (myPos < 7500) {
                    myTimeline.play(7001);
                }
            });
        } else if (x == 16) {
            $(function() {
                if (myPos > 8000) {
                    myTimeline.playReverse(8499);
                }
                if (myPos < 8000) {
                    myTimeline.play(7501);
                }
            });
        } else if (x == 17) {
            $(function() {
                if (myPos > 8500) {
                    myTimeline.playReverse(8999);
                }
                if (myPos < 8500) {
                    myTimeline.play(8001);
                }
            });
        } else if (x == 18) {
            $(function() {
                if (myPos > 9000) {
                    myTimeline.playReverse(9499);
                }
                if (myPos < 9000) {
                    myTimeline.play(8501);
                }
            });
        } else if (x == 19) {
            $(function() {
                if (myPos > 9500) {
                    myTimeline.playReverse(9999);
                }
                if (myPos < 9500) {
                    myTimeline.play(9001);
                }
            });
        } else if (x == 20) {
            $(function() {
                if (myPos > 10000) {
                    myTimeline.playReverse(10499);
                }
                if (myPos < 10000) {
                    myTimeline.play(9501);
                }
            });
        } else if (x == 21) {
            $(function() {
                if (myPos > 10500) {
                    myTimeline.playReverse(10999);
                }
                if (myPos < 10500) {
                    myTimeline.play(10001);
                }
            });
        } else if (x == 22) {
            $(function() {
                if (myPos > 11000) {
                    myTimeline.playReverse(11499);
                }
                if (myPos < 11000) {
                    myTimeline.play(10501);
                }
            });
        } else if (x == 23) {
            $(function() {
                if (myPos > 11500) {
                    myTimeline.playReverse(11999);
                }
                if (myPos < 11500) {
                    myTimeline.play(11001);
                }
            });
        } else if (x == 24) {
            $(function() {
                if (myPos > 12000) {
                    myTimeline.playReverse(12499);
                }
                if (myPos < 12000) {
                    myTimeline.play(11501);
                }
            });
        } else if (x == 25) {
            $(function() {
                if (myPos > 12500) {
                    myTimeline.playReverse(12999);
                }
                if (myPos < 12500) {
                    myTimeline.play(12001);
                }
            });
        } else if (x == 26) {
            $(function() {
                if (myPos > 13000) {
                    myTimeline.playReverse(13499);
                }
                if (myPos < 13000) {
                    myTimeline.play(12501);
                }
            });
        } else if (x == 27) {
            $(function() {
                if (myPos > 13500) {
                    myTimeline.playReverse(13999);
                }
                if (myPos < 13500) {
                    myTimeline.play(13001);
                }
            });
        } else if (x == 28) {
            $(function() {
                if (myPos < 14000) {
                    myTimeline.play(13501);
                }
            });
        } else {
            alert("Only Slides From 1-28");
        }
    });

and use this code in Xcode Action

NSString* javascriptCommand = [NSString stringWithFormat:@"index_edgeActions.js"];
[webview stringByEvaluatingJavaScriptFromString:javascriptCommand];
[hema stringByEvaluatingJavaScriptFromString:@"getElementById(12)"]

1 Answer 1

2

in iOS, UIWebview has a method to execute a javascript function:

for example:

[_myWebView stringByEvaluatingJavaScriptFromString:@"myFunc();"];
Sign up to request clarification or add additional context in comments.

5 Comments

Or you can even send a gesture
aim sorry for disturb i have edge animation (index.html+index_edge.js+index_edgeActions.js+index_edgepreload.js) how to send action from objective c code to the html or js files to tell them to perform move to specific slide
keep in your mind that there is one html file contain 5 slides
i update my question can you help me now ? and is my code correct ? NSString* javascriptCommand = [NSString stringWithFormat:@"index_edgeActions.js"]; [webview stringByEvaluatingJavaScriptFromString:javascriptCommand]; [hema stringByEvaluatingJavaScriptFromString:@"getElementById(12)"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.