Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help in AS3 Sprite

Guest
Jul 13, 2010 Jul 13, 2010

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

TOPICS
ActionScript
774
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 13, 2010 Jul 13, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 13, 2010 Jul 13, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 13, 2010 Jul 13, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 13, 2010 Jul 13, 2010
LATEST

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines