Skip navigation
Currently Being Moderated

Targeting a nested symbol's timeline?

Feb 19, 2012 7:49 AM

Hello, I'm new to Edge, Javascript and HTML5 (coming from Director/Flash/After Effects background) I'm wondering if there's a way to target a nested symbol from a button. I would like to make a simple Pause/Play toggle button that stops a nested symbol is it's playing and plays it if is stopped. In software's I'm familitar with, this can be done with a simple target path and  if/else conditional statement, but I can't find any examples that don't seem much more complicated. If you don't mind, could you please be specific as to where the code goes, as I'm new to this and don't yet have a grasp of the file structure? Thank you very much, I really appreciate your help

 
Replies
  • Currently Being Moderated
    Feb 20, 2012 5:25 AM   in reply to kalibahlu

    Hey,

     

    To access the timeline of a nested symbol, use the following in your event:

    sym.getSymbol("symbolName").getSymbol("nestedElementName").play();


    You can also access elements within a nested symbol from the stage. For example:

    sym.getSymbol("kitten_1").getSymbol("kitten_paw").$("paw").hide();// Hides the element “paw” from within a nested symbol

     

    Hope that helps!

    Sarah

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 20, 2012 8:05 AM   in reply to kalibahlu

    No problem, good luck with your project!


    Sarah

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 20, 2012 4:40 PM   in reply to sarhunt

    This clarified things for me as well; thanks Sarah.

     

    I am also new to JS and Jquery.  How would you target the parent of a nested symbol from the child of that symbol.  And also...  how would you then target an alternate nested symbol of the parent... and ultimately the child of that nested symbol... if you see what I mean

     

    I have a button on the stage and wish to have another symbol(Symbol A) change position (tween) when the button is pressed.  At the same time I wish to start the timeline of one of Symbol A's nested symbols.

     

    Getting myself notted up with the syntax.

     

    Hope you can help.

     

    Thanks

     

    Andrew

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 20, 2012 4:56 PM   in reply to elecstraw

    Hey Andrew,

     

    You'll probably be able to do all those things with the code below.

     

     

    Access the a symbol timeline within another symbol

    To access another symbol element from within a symbol, use the following in your event:

    sym.getComposition().getStage().getSymbol("symbolName").play(); // Gets the stage from the composition level, then gets the symbol and plays the timeline

     

    To access a nested symbol timeline from within a symbol, use the following:

     

    sym.getComposition().getStage().getSymbol("symbolName1").getSymbol("sy mbolName2").play(0); // Gets the stage from the composition level, gets the parent symbol, then gets the nested symbol timeline

     

    You can access elements from within a symbol timeline from within another symbol. For example:

    sym.getComposition().getStage().getSymbol("kitten_1").$("kitten_paw"). hide(); // Gets the symbol element “kitten_1” and hides the element “kitten_paw”

     

    Access a nested symbol timeline from another symbol

    To access the timeline of a nested symbol, use the following in your event:

     

    sym.getComposition().getStage().sym.getSymbol("symbolName").getSymbol( "nestedElementName").play();

     

    You can also access elements within a nested symbol from the stage. For example:

    sym.getComposition().getStage().sym.getSymbol("kitten_1").getSymbol("k itten_paw").$("paw").hide(); // Hides the element “paw” from within a nested symbol

     

    Hope that helps!


    Sarah

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 21, 2012 7:50 AM   in reply to sarhunt

    Thanks Sarah,

     

    I will give it a go...

     

    If an element is on the stage... for example a button (but1) .  Can you reference a symbol (symbol1) on the stage directly... so:

     

    sym.getSymbol("symbol1").play();

     

    or do you have to go back up to the composition and stage levels for any symbol on the stage.?

     

    Andrew

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 21, 2012 4:53 PM   in reply to elecstraw

    Success...

     

    Many thanks Sarah... managed to get my syntax right.

     

    Andrew

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 9, 2012 10:21 PM   in reply to sarhunt

    Love new features for which most of us shower you with kudos from all sides... that said you know we are a bunch of demanding scoundrels! ;D

     

    So, in the interest of moving past the congratulatory phase for a milestone worthy of a good pat on the shoulder for a job well done...

     

    - I wish there was a more visual way to target all existing symbols and elements without having to do all the singing and dancing each time... could be (or not) similart to the targeting in flash although I'd prefer a dropdown listing all the "targetable" elements and symbols (absolute and relative). That would be a really a huge help to avoid the trial and error process that is needed each time to get the target to respond to the properties being added or code being attached.

     

    - I also wish that Edge had a way to autocomplete instructions with multiple selectable suggestions (like in intelliJ IDEA et sim IDEs) where code from the linked APIs (Edge, jQuery, custom added ones) would be selectable as the code is being typed by triggering the autocomplete using a modifier key

     

    - Also snippets that could be reused over and over could prove very helpful... is there a way (other than keeping a manual archive in a commented-out code on an unused symbol) tha could serve that purpose?

     

    Lastly I've found scoping issues and I don't know if that has anything to do with targeting... but for instance, I could not define and use variables in a symbol unless I had declared on the stage on creationComplete. Just to give you an example: I could not do a simple var myVar=0; myVar++; alert (myVar); "inside" a symbol used as a button responding to a click event. Using the letter "i" withing that click event (since "i" it's likely already declared somewhere in the javascript API, would be perfectly fine as long as not "re-declaring it" using "var". The variable myVar could be used without issues once declaring it on Stage upon creationComplete as var myVar = 0;

     

    ...and as usual thanks for keeping up the awesome work!

     

    Cheers

    tfbkny

     
    |
    Mark as:
  • Currently Being Moderated
    May 26, 2013 7:57 PM   in reply to sarhunt

    sarhunt, this makes perfect sense to me - but I cannot apply it in my project!

     

    stage

         symHint2

              btnClose

     

    so btnClose is a symbol inside symHint2. I want btnClose to hide symHint2. so in the actions-for-btnClose panel, I have:

     

    sym.getSymbol("symHint2").hide();

     

    based on your logic. alas: no joy. can  you see what I cannot?

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2013 10:18 AM   in reply to Lloydie73

    I believe you should use"

    getComposition().getStage().$('symHint2').hide();

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2013 6:33 PM   in reply to resdesign

    hi redesign,

    This also makes sytactical sense, but alas: no joy

    ea_dump.png

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2013 6:39 PM   in reply to Lloydie73

    Oops. Sorry. Add sym. To the beginning!

    sym.getComposition()...

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2013 6:41 PM   in reply to resdesign

    viola! thanks a bunch.

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2013 6:44 PM   in reply to Lloydie73

    Sorry for the mistake. I was not paying attention! Glad it works. :)

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2013 6:48 PM   in reply to resdesign

    lol. thank you. so just so I have the right idea:

     

    sym.                    getComposition()      getSymbol()     $("......")

     

    namespace          root                          stage               jQuery object        

     

     

    or thereabouts?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points