Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

ID is not defined. #91

Closed
MaximilianLloyd opened this issue Jan 17, 2017 · 7 comments
Closed

ID is not defined. #91

MaximilianLloyd opened this issue Jan 17, 2017 · 7 comments

Comments

@MaximilianLloyd
Copy link

MaximilianLloyd commented Jan 17, 2017

No matter what I do I keep getting this issue.
capture
Wish I could use this tool but for now I am not capable. Help is needed urgently and would be greatly appreciated.

@MaximilianLloyd
Copy link
Author

Here is the line that it is referring to.
capture

@cjgammon
Copy link
Owner

is it possible for you to share an example .fla and scripts generating this error?

@MaximilianLloyd
Copy link
Author

I suspected the problem was my module bundler, browserify. When the libraries where not being imported with browserify it worked. Never got to the bottom of why it didn't work with browserify though.

@MaximilianLloyd
Copy link
Author

@cjgammon It is happening again. Every time i try to include it using browserify i get the error shown above.
capture1

@MaximilianLloyd
Copy link
Author

I have an Animation class which calls the SnapSVgAnimator. and it looks like this

import 'whatwg-fetch';
import config from 'components/config';

export default class Animation {
  constructor(name, width, height, container, callback, fps=30) {
    this.name      = name;
    this.width     = width;
    this.height    = height;
    this.container = container;
    this.fps       = fps;

    this.play = this.play.bind(this);

    let cachedAnimation = window.animationCache[name];
    if(!cachedAnimation) {
      fetch(`${config.basePath}/deps/animations/${name}.json`)
        .then(res => res.json())
        .then(instructions => {
          this.instructions = instructions;
          callback();
        });
    } else {
      this.instructions = cachedAnimation;
      callback();
    }
  }

  play() {
    this.comp = new SVGAnim(this.instructions, this.width, this.height, this.fps);
    this.container.appendChild(this.comp.s.node);
  }
}

@cjgammon
Copy link
Owner

If you inspect the generated SVG element does it have an ID? also if you log out this.comp.s.id what does it return? The id should be generated by Snap.svg. Also, there may be some issues with Snap.svg and browserify. adobe-webplatform/Snap.svg#344

@MaximilianLloyd
Copy link
Author

That is probably what is causing the problem. I'll try and see if I can find a work around for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants