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.
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.
Copy link to clipboard
Copied
copy and paste the error message.
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)
Copy link to clipboard
Copied
that is not exactly the same code that I posted
You need add:
import flash.display.MovieClip;
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.
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.
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);
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
Copy link to clipboard
Copied
permit debugging is ticked already. This is the error message.
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.
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
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
try
import flash.display.MovieClip;
private var myVect:Vector.<MovieClip> = new Vector.<MovieClip>(5,true);