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

Random Error Messages

New Here ,
Mar 11, 2013 Mar 11, 2013

I've been working on my second game for several weeks now and am just starting to round the corner and the finish line is in sight. 

Unfortunately, this is when everything seems to be falling apart. 

Now when I run my program, sometimes it works fine, sometimes it gives me errors.  It's not that I'm changing anything, I've tested it a few times in a row and sometimes I get 1 error, sometimes I get 5, sometimes it runs great.

The errors include:

"

/Documents/Flash_Projects/PotN/bgImage.as, Line 111021: Duplicate function definition.

//On an empty class that is only defined and added to the stage in main.as

and

/Documents/Flash_Projects/PotN/spark.as, Line 15000: The class 'spark' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

//On various game elements that have been working fine up until now, and continue to work fine sometimes.

One thing that is interesting is that in my library, the properties for my MovieClips contain an empty base class.  When I try to edit it to say "flash.display.MovieClip," flash tells me it is a native class and will be defined at runtime.  That seems irregular to me, but I am obviously still very, very new to all of this.

So that's my problem.  I haven't posted any code yet because I wouldn't even know where to start.  Any ideas or thoughts are very much appreciated, thank you!

TOPICS
ActionScript
703
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

correct answers 1 Correct answer

Guide , Mar 11, 2013 Mar 11, 2013

What is on line 11 of bgImage.as?

I think your other error will go away on its own when you fix the first error. If not, it means that you have external code on a path that Flash isn't finding where it expects it.

Note that standard coding convention for ActionScript is to start Class names with a capital letter. For example BgImage.as and Spark.as.  You may also want to try setting the Base Classes to the AS Class you're using rather than the Class.

Translate
Guide ,
Mar 11, 2013 Mar 11, 2013

What is on line 11 of bgImage.as?

I think your other error will go away on its own when you fix the first error. If not, it means that you have external code on a path that Flash isn't finding where it expects it.

Note that standard coding convention for ActionScript is to start Class names with a capital letter. For example BgImage.as and Spark.as.  You may also want to try setting the Base Classes to the AS Class you're using rather than the Class.

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
New Here ,
Mar 11, 2013 Mar 11, 2013

line 11 of BgImage.as (which I updated the name, along with all other classes) was the constructor function for BgImage.  It was only,

public function BgImage {

}

I believe, thanks to you, I found my problem.  Although I do not understand it entirely, I think I have a very elementary grasp as to what happened.

I wanted to add a preloader to the game, so I found a tutorial online that did so by unchecking "export in first frame."  So without fully finishing the tutorial or understanding what I was doing, I unchecked those boxes in all of my classes. 

I am assuming what happened was that when I unchecked those boxes, my code was executed before any class was exported, so flash never could find them.  Although it's not exactly the error message I would expect to get, it makes some sense.  Of course there's a very good chance my guess it completely off base.

Thank you very much Amy, your advice gave me a chance to take a step backward and assess the entire problem.

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
Guide ,
Mar 11, 2013 Mar 11, 2013
LATEST

I wonder if your function is literally

public function BgImage {

}

and not

public function BgImage() {

}

?

I wouldn't think that would compile without an error or warning.

Regardless, you're right that this whole thing isn't well explained.

So, here's my take on it:

When you have the "export on Frame N" checked, that means that all the Classes that have that box checked will be compiled right before the frame that you've specified. If you have frame 1 specified, then every Class with that box checked has to load before the movie can begin playing.  This is one reason I use the timeline and don't instantiate anything visual through code but popups. It's also why I usually code to interfaces--the main Document Class doesn't have a direct connection to most of the Classes used on the timeline.

However, if you choose to instantiate a library symbol in your main Document Class, then the timeline must have advanced past the point where the symbol is compiled before you can use it. This is why so many Flash movies even have preloaders--because they instantiate everything through code, so everything must be loaded before you can show anything. Kind of a shame, but that's how most people code.

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