Skip to main content
April 6, 2009
Question

1046: Type was not found?

  • April 6, 2009
  • 2 replies
  • 9638 views

In my main document I have a movie clip that holds a button. In the constructor function of my class, I want to set the alpha of the button, but am getting some errors that I don't know what to do with. The path to the button is like this:

back_next_nav.prev_btn.alpha

My class looks something like the following:

public class PrevNextNav

{

     public var back_next_nav:MovieClip;

     public var prev_btn:Button;

    

     public function PrevNextNav()

     {

          back_next_nav.prev_btn.alpha = .3

     }

     ..... etc.

I get these error:

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

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

This topic has been closed for replies.

2 replies

--TimK--
Participating Frequently
April 6, 2009

You have to import the classes to use them.

import flash.display.MovieClip;

import fl.controls.SimpleButton;

public class PrevNextNav

{

     public var back_next_nav:MovieClip;

     public var prev_btn:Button;

  

     public function PrevNextNav()

     {

          back_next_nav.prev_btn.alpha = .3

     }

     ..... etc.

April 6, 2009

I imported the classes now, but am still getting errors.

import flash.display.MovieClip;

import fl.controls.SimpleButton;



Errors are:

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

--TimK--
Participating Frequently
April 6, 2009

Woops I'm sorry there. You need to import Button not SimpleButton. Change the one line to:

import fl.controls.Button;

Ned Murphy
Legend
April 6, 2009

Do you import those classes into the file?