Skip to main content
Inspiring
June 7, 2007
Answered

1045 Interface Questions AS3

  • June 7, 2007
  • 2 replies
  • 1759 views
Hello,

I've recently decided to take a look at AS3, and I was in the process of seeing what kind of changes I needed to do with my code to make it AS3 compliant. I did the changes to import the flash.display.MovieClip class. As I was going through this circular pattern (compile, flash tells me what's wrong, I correct it...) this one area has stumped me.

I get the following error: "1045: Interface newI was not found."

What am I doing wrong? Are Interfaces allowed with AS3 code?

Thanks,

Kelly


This topic has been closed for replies.
Correct answer KellyVernon
It works for me.


Ahhh ha! Man I hate the little things! hciguy, thanks for all your help. I changed the interface to include package wrapper, but I also found out it was because I didn't declare something to be public (the class decloration)

Thanks again,

Kelly

2 replies

Inspiring
June 7, 2007
Yeah, that's what's so confusing. I've seen the references in the docs (and even how it allows getter/setter functions now), but no matter what, each interface I try(event the example above) becomes not found.

It (Flash) walked me through the error of the interface file when I originally created and implemented it (was originally "public function announceEvent( t:Number):void;"
), but after I corrected that error, I received error 1045. How can it see it at one point and not see it at another?

Does anyone else have this problem by chance?

Cheers,

Kelly

*edit (a couple of quick grammatical errors)
Inspiring
June 7, 2007
Do you have to import the interface file or anything? Sounds like a problem locating it.
Inspiring
June 7, 2007
yeah, I've tried that too (see code for the variation). It still tells me that the same line (class something extends MovieClip implements newI{) still can't find the interface.


Thanks.

Kelly

Inspiring
June 7, 2007
While I do not know the problem, it appears AS 3.0 does still have interface keyword:

"interface definition keyword
Usage


interface InterfaceName [extends InterfaceName ] {}

Language Version : ActionScript 3.0
Player Version : Flash Player 9

Defines an interface. Interfaces are data types that define a set of methods; the methods must be defined by any class that implements the interface.

An interface is similar to a class, with the following important differences:

* Interfaces contain only declarations of methods, not their implementation. That is, every class that implements an interface must provide an implementation for each method declared in the interface.
* Interface method definitions cannot have any attribute such as public or private, but implemented methods must be marked as public in the definition of the class that implements the interface.
* Multiple interfaces can be inherited by an interface by means of the extends statement, or by a class through the implements statement.

Unlike ActionScript 2.0, ActionScript 3.0 allows the use of getter and setter methods in interface definitions.

Note: To use this keyword, you must specify ActionScript 2.0 and Flash Player 6 or later in the Flash tab of your FLA file's Publish Settings dialog box. This keyword is supported only when used in external script files, not in scripts written in the Actions panel.

See also
class
implements
Interfaces"

From http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ under Statements, Keywords, etc.