-1

I'm trying to convert my as3 project to html5 canvas using animate cc I have the as3 code below to clone MovieClip on stage and need it using html5 canvas.

function getClass(obj:Object):Class {
    return Class(getDefinitionByName(getQualifiedClassName(obj)));
 }
var mc=getClass(this.getChildByName("myMc"))
halfer
  • 19,824
  • 17
  • 99
  • 186
Enas S3efan
  • 81
  • 1
  • 11
  • _"..using animate cc"_ So what's the exact problem? Does Animate CC refuse to generate or export HTML content from the AS3 code? Do you get error message(s)? – VC.One Mar 26 '19 at 08:37
  • Uncaught ReferenceError: Class is not defined – Enas S3efan Mar 26 '19 at 08:59
  • Are you converting this to JS? If so, may we see the JS? – halfer Mar 26 '19 at 09:02
  • the code inside html5 canvas var stage=this function getClass(obj) { return Class(getDefinitionByName(getQualifiedClassName(lib.obj))); }var mc=getClass(stage.nn.getChildByName("Mymc")) – Enas S3efan Mar 26 '19 at 09:06
  • What problem are you trying to solve by creating a `function getClass`? Maybe there's a different solution... Anyways, I doubt you can `return Class` also there are no function parameters allowed for a `Class` object so no point for the code with `...getQualifiedClassName(obj)...` etc. The [**AS3 Manual**](https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Class.html) tells you on its line 8 that _**"Generally, you do not need to declare or create variables of type Class manually."**_ and your `return Class` logic sounds like trying to manually create a Class, is that right? – VC.One Mar 26 '19 at 11:31
  • if I want to create new instance from a movieClip in the library by giving it a linkage name we can do like this "var mc=new lib.myMc" where myMc is the linkage name but my problem is that I want the linkage name in arabic language :) – Enas S3efan Mar 26 '19 at 11:47

1 Answers1

0

That's it :)

stage.nn.gotoAndStop("cow");
var mc=stage.nn.getChildAt(0).clone()
mc.x=100
mc.y=100
stage.addChild(mc)

Thanx All :)

Enas S3efan
  • 81
  • 1
  • 11