Copy link to clipboard
Copied
Hello All,
I got this Error : 1061: Call to a possibly undefined method addChild through a reference with static type Class.
what I'm trying to do :
I have create a new class called Graph and make it extends Sprite and add a scroolpane to my stage and make an empty movie clip called content_mc and make the source of the scrollpane equals to content_mc
in the first frame i wrote this code
import Graph;
var graph:Graph = new Graph();
content_mc.addChild(graph);
Any help will be appreciated
Thanks in Advance
Copy link to clipboard
Copied
click file/publish settings/flash and tick "permit debugging". retest. the line number with the error will be in the error message. if that's the same line as one you posted, show how you create content_mc.
Copy link to clipboard
Copied
Thanks for your reply
I did what you say , but I still have the same error
and I have create the content_mc
insert-> new symbol -> Enter the name of content_mc -> choose the option export fpr actionscript and then click ok
and I have creating some shapes in it and test it with the scrollpane and it's working
but when i remove the shapes and use the action script to add an inistance from my graph to it i have the previous error
Thanks in Advance
Copy link to clipboard
Copied
I have tried to put the code inside the first frame of content_mc and it's works when i was drawing a shape inside the movie clip but when i removed the shape it doeasn't work
Copy link to clipboard
Copied
and that's why you're getting that error message. a class is not the same as an instance.
if content_mc is the class name of that movieclip, you would use something like:
var c_mc:content_mc = new content_mc();
to create a class instance, c_mc. you could then use:
addChild(c_mc):
var graph:Graph = new Graph();
c_mc.addChild(graph);
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more