Skip to main content
Participating Frequently
September 16, 2018
Answered

Flash to html5 conversion - How to fix "missing name after . operator"?

  • September 16, 2018
  • 1 reply
  • 653 views

Converting an animate CC  project from flash to html5 and the first console error I get when running the app in FF is "SyntaxError: missing name after . operator".

The error code is:

(lib. = function(options) {

this._element = new $.(options);

this._el = this._element.create();

var $this = this;

this.addEventListener('added', function() {

$this._lastAddedFrame = $this.parent.currentFrame;

$this._element.attach($('#dom_overlay_container'));

});

}).prototype = p = new cjs.MovieClip();

p.nominalBounds = new cjs.Rectangle(1,1,98,20);

p._tick = _tick;

p._handleDrawEnd = _handleDrawEnd;

p._updateVisibility = _updateVisibility;

I have searched through my AS3 code and cannot find any classes that would match up to this and am at a loss how to correct the error.  Any insight into where I should be looking would be much appreciated. Thinking that some high level class declaration might be missing?

This topic has been closed for replies.
Correct answer kglad

Hi, kglad.

I must admint that I looked at the js and saw the old AS3 commented out plus lots of new js lib.name constructs that were equivalients to the old AS3 classes and assumed all the as3 code had been crossed converted (but I'd not found it yet).

So I still don't know where this unnamed lib comes from... I guess I'll just have to delete it and see what happens next.

So, I now know I have a huge heap of AS3 code to convert... Shame on me for seeing all those "Easily convert AS3 to HTML5" tutorials without looking into them too closely.  So I'll roll up the sleeves and see how much effort it's going to take. 

I've spent the last hour looking for good information on converting from AS3 to Javascript/Canvas and am slowly finding out little bits and pieces from various forums... Seeing as I've got to learn it from scratch it might be the right time to start again in unity.

Just wondering what's wrong with Adobe for not providing a solid resource for people like me who are now being forced to dump or convert old flash projects.  If we has such a resource we'd stop pestering the good folks on this forum!  Perhaps it's out there and I've just not found it yet?


it's not necessarily easy to convert as3 to js.  a lot of it is convertible because some of as3 is like as2 and as2 is like js.

but a lot of as3 (variable typing, eg) isn't like as2/js.  and a lot of as3 has no direct js equivalent.

that said, here's documentation for a lot of the js library (createjs) used by animate, https://createjs.com/docs

and you can use any js in animate.  so between documentation on js and the above link, you can convert as3.  but again, it's not necessarily easy.

1 reply

kglad
Community Expert
Community Expert
September 16, 2018

how did you convert your as3 to js?

HGLBrizoAuthor
Participating Frequently
September 16, 2018

Hi Kglad,

I simply used the file>convert to...>html5 canvas.

kglad
Community Expert
Community Expert
September 16, 2018

no as is converted when you do that.  it's all commented-out.