Skip to main content
Participating Frequently
June 17, 2011
質問

Scene 1 1046: Type was not found or was not a compile-time constant: tractor_mc.

  • June 17, 2011
  • 返信数 3.
  • 3659 ビュー

This is driving me crazy because I know it has to be something simple on my part.

I created a new document with two layers labeled, content and actions.

I then create a movieclip named tractor_mc. I create two layers in tractor_mc, one called images, the other called actions.

In frame one of tractor_mc, actions layer, I enter:

stop();

trace("tractor_mc has stopped");

I test the movie and it stops on the first frame and returns, "tractor_mc has stopped". All works well!

I then choose scene 1.

The layer named tractor_mc, has only 1 frame which contains the movieclip tractor_mc, which has the instance name of tractor_mc.

I go to frame one of actions and enter:

trace("this is scene1, frame1");

Test movie and get the expected output of:

this is scene1, frame1
tractor_mc has stopped

Now this is where my problem arrises:

In Scene 1, action layer frame one, I add the code:

trace("this is scene1, frame1");

tractor_mc.gotoAndStop(3);

This returns the error:1046: Type was not found or was not a compile-time constant: tractor_mc.

If I remove the tractor_mc.gotoAndStop(3); I still get the error message and the movie clip runs continously.

Am I missing something? I've been thinking about it too long and I'm afraid the answer is right in front of me!

Any suggestions would be helpful.

このトピックへの返信は締め切られました。

返信数 3

Skwent作成者
Participating Frequently
June 17, 2011

Thank you both for your help, but I think I figured it out just after I posted my question. I hate it when that happens!

I opened the properties of tractor_mc, and changed the name to images_mc. I also changed the class to images_mc. I left the movie clip instance, "tractors_mc" as it was and all works well. I'm hoping that is what the problem was as everything is running smooth now.

Thanks for your time!

Ned Murphy
Legend
June 17, 2011

Yes, you can't use the same instance names for objects as you do for their class names.  As for assigning the class names, you don't need to assign one if you only plan to add the object to the stage manually.  Assigning class names to library objects gains meaning when you want to dynamically add them.

Ned Murphy
Legend
June 17, 2011

I have to think that if you remove that line of code then you can't get that error again unless you have some other code somewhere that is using "tractor_mc" incorrectly.  If you aren't aware of any other use of that in your code, maybe you should use the Movie Explorer utility (Window -> Movie Explorer) to try to track down code you might have elsewhere that is causing the issue.

kglad
Community Expert
Community Expert
June 17, 2011

click file/publish settings/flash and tick "permit debugging".  retest.

the line number(s) of the problematic code will be in the error message.  you'll need to fix each error.  fix the first and then retest continuing to fix the first and retesting until you've fixed all error messages.