1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    2
    Vote Rating
    0
    deschnerc is on a distinguished road

      0  

    Default How to control an embedded sencha animation from outside?

    How to control an embedded sencha animation from outside?


    Hi,

    I want to embed a sencha animation with 2 scenes in an iframe and i want to control the sencha file from outside. How can I access "the startSceneByID()" from outside?

    I tried it like this:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script language="javascript">
    function navScene(sid){
    window.frames.sencha_content.AN.controller.startSceneByID(sid);
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Unbenanntes Dokument</title>
    </head>

    <body><iframe width="480" height="320" src="index.html" id="sencha_content" name="sencha_content"></iframe><br/><a href="javascript:navScene(0)">Click...</a>
    </body>
    </html>

    Thanks a lot...

    Chris

  2. #2
    Sencha User
    Join Date
    Dec 2012
    Posts
    2
    Vote Rating
    0
    deschnerc is on a distinguished road

      0  

    Default


    -> It works...

  3. #3
    Sencha User arnebech's Avatar
    Join Date
    Jun 2010
    Posts
    498
    Vote Rating
    10
    arnebech will become famous soon enough

      0  

    Default


    So in 1.3 there is no automatic reference to the controller available. One way to get around this is to add a start action to the project (Project Tab -> Actions -> Start) and set it to for example
    Code:
    window.controller = controller;
    then you should be able to get to the controller from the parent document using your method (if you name the iframe "sencha_content")
    Code:
    window.frames.sencha_content.controller.goToNextScene()
    or just looking for the iframe on the page (assuming you only have one)
    Code:
    document.querySelector('iframe').contentWindow.controller.goToNextScene()
    A potential issue for both these approaches is that you can only get the controller after the animation has initialized, otherwise it will cause an error. One way to make it safer is to wrap the call in a try catch block like so:

    Code:
    try {
        document.querySelector('iframe').contentWindow.controller.goToNextScene();
    } catch (error) {
        console.log("Animation likely not loaded yet", error);
    
    }

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi