• HOME
  • NEWS
  • PORTFOLIO
  • LAB
  • ABOUT
  • CONTACT

Global function in Adobe Edge animated

categories : programmation

by Trân on May 14, 2014

To create truly global variable in Edge animated, define in a symbol (usually inside the Stage.compositionReady event handler, a good place for global stuff) :

sym.globalFunction = function(){
// statements
}

To call this function from another symbol :
sym.getComposition().getStage().globalFunction();

Here the variable holds a function, but it could hold a number, string, etc.

Ludlow interior » « Instagram inspiration

7 thoughts on “Global function in Adobe Edge animated”

  1. Roger Eaton says:
    January 9, 2015 at 7:32 am

    Nested Objects:

    This is great when the object is on the stage. But what if it is in a symbol? Or nested inside a nested symbol. When I took the rectangle and ellipse I had created and placed them inside a symbol, the code immediately broke. Do you know why?

    Thanks,

    Roger

    Reply
  2. Roger Eaton says:
    January 9, 2015 at 7:40 am

    I tried

    sym.rectMouseIn = function(){
    // statements
    sym.getComposition().getStage().getSymbol(“Symbol_1”).getSymbol(“Ellipse”).fadeTo(0,0);
    sym.getComposition().getStage().getSymbol(“Symbol_1”).getSymbol(“Rectangle”).fadeTo(0,1);

    }

    But it does not work.

    Reply
    1. admin says:
      March 26, 2015 at 4:53 pm

      Dear Roger,
      Sorry for the late delay,
      if you want to manipulate DOM nested elements, you have to get the symbol element : sym.getComposition().getStage().getSymbol(“Symbol_1″).getSymbol(“Ellipse”).getSymbolElement().fadeTo(0,0);

      Reply
  3. Grace says:
    May 9, 2015 at 1:12 am

    Hi, I’d like to reference a class, so 4 symbols will play in tandem. But it will not work. Is it impossible to play a class? I see/think of no reason…

    Menu button – nested in a symbol
    4 different symbols – given class “indef”

    In compositionReady:

    sym.playIndef = function() {
    sym.getSymbol(“.indef”).play(“article”);
    }

    Or another problematic application of class. Only one of the four plays.
    Also in compostionReady:

    sym.flipPersonals = function() {
    sym.getSymbol(“.personals”).play();
    }

    Code on the menu button1:
    sym.playIndef();

    On the menu button2:
    sym.flipPersonals();

    Any help for me? Thanks Creative Coder!

    Reply
    1. admin says:
      May 9, 2015 at 2:52 am

      Dear Grace,

      You can select Edge Animate symbols with a class using :
      jquery sym.$(“.indef”) and not sym.getSymbol(“.indef”)

      but you won’t be able to target their timeline, it won’t work :
      sym.$(“.indef”).play(‘article’); // not working
      sym.$(“.indef”).css(‘opacity’, .5); // works because it’s a jquery method

      You have to think symbol’s instance name as id more than class

      Reply
  4. Felipe says:
    February 22, 2016 at 9:56 pm

    Hi, thanks for the help this site gives.
    I have a question, how I can call a funtion from a button in the stage?

    The function is in the composition ready panel

    function ej() {
    sym.getSymbol(“cr1”).play();
    }

    What code I must put in the button at stage to call this function?

    Thanks for your valuable support.

    Reply
    1. Trân says:
      March 24, 2016 at 9:48 pm

      Hi odinx07,

      I would link your function to the global window object, so I would write :
      window.ej = ej;

      Then in your button you could call window.ej();

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

 
 

© fruit du dragon - freelance creative coder

Categories

  • général
  • inspiration
  • lab
  • programmation
  • sites
  • work

Tags

android architecture archives canvas cellules-studio cornelius css culturel demonstrateur design eshop flash fremok html html/css/js hugo IFTTT incandescence Instagram institutionnel ios ipad jeux js krpano luxe media design mobile musée nomoon paper fold photographie requins-marteaux responsive sbam snippet tablette toute-attente tran nn transport typographie ui ultranoir woocommerce wordpress

Stats


Notice: Undefined variable: extra in /home/tigerbal/www/wp-content/plugins/pulsemaps/pm-widget.php on line 47

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org