Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Colin Ochel

Adobe Animate function not firing a TweenMax

Recommended Posts

Im leveraging Adobe Animate to build a banner. It works great except for one new issue. 

 

I have a video play when I click a movieClip (c4). The video plays but the TweenMax animation does not fire.

 

In fact, if I put the TweenMax code before the video, the video does not play.

 

Below is the focused code.

 

this.c4.addEventListener("click", playvideo); 
  
function playvideo () {  
 
//attach video element to body
var bodyElement = document.body;
bodyElement.insertBefore(videlem, bodyElement.childNodes[0]);
videlem.play();
 
TweenMax.to(this.c10, 1, {alpha:1, ease: Power2.easeOut}, "+=0") ;
 
}
 
----
 
Does anyone have an idea why the animation does not fire? It fires outside the function.
 
Cheers
Link to comment
Share on other sites

Perhaps narrow it down to seeing if it's a scope issue. So outside the function make a reference to the clip.
 

var myClip = this.c10;

Then in your function change this.c10 in the tween to myClip, then see if it works.

Also, I believe it would be this.playvideo in the event listener, not just playvideo -- this might be the issue as well.

  • Like 2
Link to comment
Share on other sites

Thanks for the comment.

 

Just to be clear, The TweenMax works if it sits outside of the function and the video works as well. (The video code is Sizmek code)

 

So this works.

 

this.c4.addEventListener("click", playvideo); 
 
TweenMax.to(this.c10, 1, {alpha:1, ease: Power2.easeOut}, "+=0") ;
 
function playvideo () {  
 
//attach video element to body
var bodyElement = document.body;
bodyElement.insertBefore(videlem, bodyElement.childNodes[0]);
videlem.play();
 
}
 
---------------
 
This plays the video but not the TweenMax animation. (when the TweenMax is after the video code)
 
 
this.c4.addEventListener("click", playvideo); 
 
function playvideo () {  
 
//attach video element to body
var bodyElement = document.body;
bodyElement.insertBefore(videlem, bodyElement.childNodes[0]);
videlem.play();
 
TweenMax.to(this.c10, 1, {alpha:1, ease: Power2.easeOut}, "+=0") ;
 
}
 
 
---------------
 
This does not play the video so it appears that the TweenMax is throwing an error but why?
 
this.c4.addEventListener("click", playvideo); 
 
function playvideo () {  
 
TweenMax.to(this.c10, 1, {alpha:1, ease: Power2.easeOut}, "+=0") ;
 
//attach video element to body
var bodyElement = document.body;
bodyElement.insertBefore(videlem, bodyElement.childNodes[0]);
videlem.play();
 
}
Link to comment
Share on other sites

Hey, that worked. Thanks Davi!

 

I had it as this.myClip at first but myClip worked. Thank you again.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×