Jump to content

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

Manipulating timeline inside iframe

Recommended Posts

function handleComplete(evt) {
    exportRoot = new lib.somersbycoop728x90fr();

    stage = new createjs.Stage(canvas);

    createjs.Ticker.addEventListener("tick", stage);

    // console.log(exportRoot);
    // globalTimeline = TimelineLite.exportRoot(exportRoot);


Is there any option to pause, resume, and seek timeline of banner inside iframe?
Above code is from banner.

Share this post

Link to post
Share on other sites

Hi and welcome to the GreenSock forums,


If your banner and parent document are loaded from the same domain, then I believe yes.

Your globalTimeline var will also have to be attached to window (be globally accessible).


This stackoverflow post illustrates how to target a variable in an iframe from parent:





  • Like 2

Share this post

Link to post
Share on other sites

I tried to get that variable but globalTimeline is not defined. 

We have one banner that has one stage or scene which is in loop even timeline is paused.


function Pause() {
  if (stage && stage.children) {

    var i, l = stage.children.length;

    for (i = 0; i < l; i++) {
      var child = stage.children[i];


      if ("gotoAndStop" in child)
        var pos = parseInt(child.timeline.position);


This is part of the code I use to pause the timeline, do you think this is correct way?

Share this post

Link to post
Share on other sites

Sorry, I have no idea what that code is supposed to do. I don't see globalTimeline defined nor do I know what stage.children is or what child.timeline.setPaused = true is. That looks more like CreateJS code and not GreenSock code.


We really have to stay focused on the GSAP API. 

I would suggest you set up a VERY basic demo of a page that loads an iframe with a single variable or object in it. Try accessing that variable from the parent. If you get that to work, re-assign that variable to your timeline. Unfortunately If you can't target a single variable in an iframe then there is no point in dealing with the complexity of the second part (timelines, parents, stages, loops, etc). 


I haven't dealt with iframes much and there are quite a few security measures that browsers impose. I think you will do best on stackoverflow or somewhere else that deals with more general webdev issues. 



  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.