1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    6
    Vote Rating
    0
    mirkodemo is on a distinguished road

      0  

    Default change symbol timeline from another symbol

    change symbol timeline from another symbol


    hello,
    I have a symbol (a) with a function "on click" on it; this function tells to get another symbol (a) in the stage.

    I wan't to switch the timeline of that symbol (b) with the next one by clicking the first symbol (a)

    here is the code:


    var y = 0; //set y
    var x = 0;
    try{
    var virus = $( '#symbolA' );
    var pos = virus.position();

    x = pos.left + (virus.width()/2);
    y = pos.top + (virus.height()/2);
    var element = controller.getElementById('symbolB'); //here I need to get the inner timeline
    element.style.webkitTransform = 'translate('+x+'px,'+y+'px)'; //for webkit
    element.style.transform = 'translate('+x+'px,'+y+'px)'; //unprefixed
    } catch(err) {
    console.error(err);
    }



    how can I do it?

    thank's

    mirko

  2. #2
    Sencha - Architect Dev Team
    Join Date
    Apr 2012
    Posts
    282
    Vote Rating
    23
    miro.bojic will become famous soon enough miro.bojic will become famous soon enough

      0  

    Default


    Hi mirkodemo,

    You should use controller.getSymbolByInstanceId( id ) (see http://docs.sencha.com/animator/1.5/.../AN.Controller). While instance ID's cannot be set manually to avoid possible conflicts, auto-complete in the editor will list all ID's so you can easily select the right one.

    After that you can use element.goToTimelineByName('name of the timeline');

    Take a look at Haunted Mansion project that is included with Animator, this kind of functionality is used quite a lot throughout the scenes (e.g. take a look at Timeline->Actions->Start in Scene 2, timeline 'Door').

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Posts
    6
    Vote Rating
    0
    mirkodemo is on a distinguished road

      0  

    Default


    thank's for your answer, but I need to fire that action directly from my symbol A, not with a second timeline that call the inner timeline of the symbol

    I have only one timeline and, like I did in my code, retrieve a symbol B by clicking symbol A and positioning it with the axis of the cursor. what I need is to play the next timeline of my symbol B (inside of him) by clicking the external symbol A.

    the example that you have provided to me fire the action at the start of a timeline of the scene

    any clues?

    thank's again

    mirko

  4. #4
    Sencha - Architect Dev Team
    Join Date
    Apr 2012
    Posts
    282
    Vote Rating
    23
    miro.bojic will become famous soon enough miro.bojic will become famous soon enough

      0  

    Default


    Hi mirkodemo,

    I didn't realize you need to access a child symbol within the symbol - I thought both are placed in the scene. In this case you need to use symbolController.getChildSymbolByInstanceId() - the rest of the code should be the same.

    I created a quick example for you to see it in action - https://github.com/mbojic/example_symbol_within_symbol (if you don't use github, you can click 'Download as ZIP' on the page)

    Hope it helps!

  5. #5
    Sencha User
    Join Date
    Jul 2013
    Posts
    6
    Vote Rating
    0
    mirkodemo is on a distinguished road

      0  

    Default


    really thank's for the demo! it was perfect! But I need a little more step in order to accomplish my job....at this link

    http://we.tl/dkbiuU4IUt

    I provide to you your example with my mod. I insert an animation on the background and when I click to activate the trigger of the inner symbol (your animation), it doesn't start until my animation of the BK ends. how can I resolve this problem?

    thank's again


    mirko

  6. #6
    Sencha - Architect Dev Team
    Join Date
    Apr 2012
    Posts
    282
    Vote Rating
    23
    miro.bojic will become famous soon enough miro.bojic will become famous soon enough

      0  

    Default


    It seems you might have discovered a browser specific problem. I tested your example in Chrome, Firefox and Safari, and it seems that the behavior you're describing only occurs in Safari, while in Chrome and Firefox everything works as expected (i.e. the animation of the inner symbol is started instantly, you don't need to wait while the animation of the outer symbol finishes).

    We will look into this if it is something that can be remedied by creating the animation in a different way so that it works correctly in Safari as well. Thanks.

  7. #7
    Sencha User
    Join Date
    Jul 2013
    Posts
    6
    Vote Rating
    0
    mirkodemo is on a distinguished road

      0  

    Default


    yes! is that the case. so I await for further update.

    many thank's


    mirko

Thread Participants: 1

Tags for this Thread