Created
August 13, 2013 14:45
-
-
Save cfjedimaster/6221864 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************** | |
* Adobe Edge Animate Composition Actions | |
* | |
* Edit this file with caution, being careful to preserve | |
* function signatures and comments starting with 'Edge' to maintain the | |
* ability to interact with these actions from within Adobe Edge Animate | |
* | |
***********************/ | |
(function($, Edge, compId){ | |
var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes | |
//http://stackoverflow.com/a/488073/52160 | |
function isScrolledIntoView(elem) { | |
var docViewTop = $(window).scrollTop(); | |
var docViewBottom = docViewTop + $(window).height(); | |
var elemTop = $(elem).offset().top; | |
var elemBottom = elemTop + $(elem).height(); | |
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) | |
&& (elemBottom <= docViewBottom) && (elemTop >= docViewTop) ); | |
} | |
//Edge symbol: 'stage' | |
(function(symbolName) { | |
Symbol.bindSymbolAction(compId, symbolName, "creationComplete", function(sym, e) { | |
console.log("Ready"); | |
mysym=sym.getSymbol("Symbol_1"); | |
//force it to be block | |
mysym.element.css("display","block"); | |
if(isScrolledIntoView(mysym.element)) { | |
mysym.play(0) | |
} else { | |
$(window).on("scroll", function(e) { | |
if(isScrolledIntoView(mysym.element)) { | |
console.log('Start me up'); | |
mysym.play(0); | |
$(window).off("scroll"); | |
} | |
}); | |
} | |
}); | |
//Edge binding end | |
})("stage"); | |
//Edge symbol end:'stage' | |
//========================================================= | |
//Edge symbol: 'Symbol_1' | |
(function(symbolName) { | |
})("Symbol_1"); | |
//Edge symbol end:'Symbol_1' | |
})(jQuery, AdobeEdge, "EDGE-10866332"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment