Adobe Edge: control a specific symbol from html page

天大地大妈咪最大 提交于 2019-12-06 14:41:07

问题


I need to control over one of my edge Symbols, from my HTML page (index.html - not the edgeActions.js page)

For example, I have an image Symbol: "sym1", and I want to hide it from the main html page. I tried:

sym.$( "sym1" ).hide();

But it doesn't work..

That's the only way I could make it work (In edgeActions page only):

  Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
         var ex1 = sym.$( "sym1" );         

         yepnope({
            both: [
                "libs/jquery-ui.min.js",
                "libs/jquery-ui.css",
            ],
            callback: function() {

         ( ex1 ).hide();
            }
         });

      });

I need to understand how can I control the symbol from the main html page with JQuery.


回答1:


Grabbing symbols when you're outside of the edge program require you to do a bit more than call "Symbol." So let me just walk you through how to grab your symbol:

1st - You have to get a reference to the specific composition. This will generally be the class on the #Stage element. If you don't give it a specific name in Edge Animate, the default name will be something weird like EDGE-1230930194.

var myAnim = AdobeEdge.getComposition("nameOfComposition");

2nd - You need to grab the specific symbol

var mySymbol = myAnim.getSymbols("nameOfSymbol")[0]; // Because it's in an array

And there ya have it! You got yourself the symbol. If you wanted to play it in reverse for example then you'd do this:

mySymbol.playReverse();

The more interesting things to do for finer manipulation involve grabbing the underlying element like so:

var mySymbolElem = mySymbol.getSymbolElement();

And then of course you can use any jQuery methods to mess around with it:

mySymbolElem.fadeOut(5000, function(){alert("alerts rox")});

Hope that helps!




回答2:


After Edge render to html page, all symbol will be merge with a new id name are connected by an "_". For example if you want to change an image of a symbol named "thumb01":

$('#Stage_thumb01').css('background-image',  'url('thumb_img_02.jpg')');

"Stage" is a root default container of an Edge html



来源:https://stackoverflow.com/questions/13556152/adobe-edge-control-a-specific-symbol-from-html-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!