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

vector. error 1046. Type was not found or was not a compile type...

Participant ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

Type was not found or was not a compile type constant at compile time.

BUT I have imported import flash.display.MovieClip; amd my vector variable declaration is correct.

private var myVect:Vector.<MovieClip >  = new Vector.<MovieClip > (5,true);

I am even copying and pasting from a tutorial so this is very strange.

TOPICS
ActionScript

Views

3.2K

Translate

Translate

Report

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

Community Expert , Jul 18, 2012 Jul 18, 2012

there's another as3circle class being used by whatever fla you're using to test.

if the code you've shown has been saved to as3circle.as, try using a new directory to save your fla and your class.  if you haven't saved your shown code to that file, save it and retest.

Votes

Translate

Translate
Community Expert ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

copy and paste the error message.

Votes

Translate

Translate

Report

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
Participant ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

1046: Type was not found or was not a compile-time constant: MoveiClip

That is th error that appears in the compiler errors window.

(esdebon - that's exactly the same code that I posted)

Votes

Translate

Translate

Report

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
Enthusiast ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

that is not exactly the same code that I posted

You need add:

import flash.display.MovieClip;

Votes

Translate

Translate

Report

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
Participant ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

I didn't make it perfectly clear in the first post - but it is there and in my code. That was the first thing I look for as it often happens to me.

Votes

Translate

Translate

Report

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 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

tick file/publish settings/swf and tick "permit debugging".   take a screenshot showing the error message and attach it here.

take a sceenshot of the first 20 or 30 lines of that class showing you import statement and class name.  attach it here.

Votes

Translate

Translate

Report

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
Participant ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

Sorry won't let me insert image BUT I have enabled debugging and I get those three errors about the same MovieClip.

The error I quoted above and the following.

1120: access of undefined property MovieClip (twice)

package

{

          import flash.display.MovieClip;

          import flash.media.Sound;

          import flash.events.MouseEvent;

          import flash.display.Sprite;

          import flash.events.Event;

          public class as3circle extends Sprite

          {

                    public var keyboard_input:keys;

                    public var circle_hero = new circle  ;

                    private var energyHit:Boolean = false;

                    private var enemy:Enemy = new Enemy();

                    private var myVect:Vector.<MovieClip >  = new Vector.<MovieClip > (5,true);

                    

    

                    public function as3circle()

                    {

                              //Gerry hack. Make the helicopter smaller via code as I can't edit it properly

                              circle_hero.scaleX = .25;

                              circle_hero.scaleY = .25;

                              addChild(circle_hero);

                              circle_hero.init();

 

                              var keyboard_sprite = new Sprite();

                              addChild(keyboard_sprite);

                              keyboard_input = new keys(keyboard_sprite);

                              //add the enemies

                              for (var i:int=0; i< 5; i++)

                              {

                                        //enemy = new Enemy  ;

                                        enemy.x = Math.random() * stage.stageWidth;

                                        enemy.y = 0 + i * stage.stageHeight / 6;

                                        myVect = enemy;//populate the vector array with enemies. Vectors only hold one type but they are so efficient.

                                        addChild(enemy);

                                        enemy.cacheAsBitmap = true;

                              }

                              stage.addEventListener(Event.ENTER_FRAME,on_enter_frame);

Votes

Translate

Translate

Report

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 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

that error message won't be triggered by anything you've shown.

tick file/publish settings/swf and tick "permit debugging".   copy and paste the complete error message

Votes

Translate

Translate

Report

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
Participant ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

Captura.PNGpermit debugging is ticked already. This is the error message.

Votes

Translate

Translate

Report

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 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

there's another as3circle class being used by whatever fla you're using to test.

if the code you've shown has been saved to as3circle.as, try using a new directory to save your fla and your class.  if you haven't saved your shown code to that file, save it and retest.

Votes

Translate

Translate

Report

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
Participant ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

Thanks. I cut and pasted and also changed the classes to have capital letters (upper case) and now all works - God only knows why but it does in this format and it didn't before. An enigma.

Cheers

Votes

Translate

Translate

Report

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 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

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
Enthusiast ,
Jul 18, 2012 Jul 18, 2012

Copy link to clipboard

Copied

try

import flash.display.MovieClip;


private var myVect:Vector.<MovieClip> = new Vector.<MovieClip>(5,true);

Votes

Translate

Translate

Report

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