A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    16

    Interface methods not implemented

    Hey there peeps


    I have an object in the library that is linked with class Myclass, I define MyClass in its own AS file and everything runs ok, but as soon as I remove the linkage of the object with the class the compiler generates an error with a seemingly totally different class, that class is part of an open source data structure library for AS3, unrelated to that library object or class MyClass.

    The error code is 1044: Interface method ****** in namespace ******* not implemented by class ********.

    And of course I checked and the class implements the interface methods, all of them so there should be no errors.

    The library I'm using is at http://lab.polygonal.de/ds/
    and the class reporting errors is HashMap and HashTable
    I'm almost 100% percent sure that there the library is not the problem though.


    Anyone know what could be happening ?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Does Myclass extend the same class on it's own that is specified as the base class for your library symbol?

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    16
    MyClass extends from other class, the only reason I linked the MyClass with the library object is because that library object contains a graphic. I want to remove the linkage and load manually the graphics inside the class.

    The funny thing is that if I don't use HashMap and HashTable everything works ok, but I really doubt the library is faulty, can anyone check this for me ?

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    I'm still foggy on exactly which data is going where but it sounds like you're trying to use HashMap or HashTable as a displayObject - so if you subclass those (or rewrite them or whatever) - you'll need to also extend Sprite or MC as well as implementing all the functions specified in whichever interface(s) you're using.

  5. #5
    Junior Member
    Join Date
    Apr 2009
    Posts
    16
    Suppose one day you wake up and want to make a car game, you make a sprite and call it car, it is stored in the library. You make a class called MyCar (which extends from Sprite) and you link the sprite car in the library to this class (MyCar) to avoid the hassle of having to load manually the graphics (from a simple png file), So whenever you make an instance of the object in the library, the class MyCar is linked to it, everything runs ok.

    But then later on you think, damn having graphics linked to classes is kind of messy, I should load everything by code like in other languages, so you go to the library and uncheck the linkage of the car sprite and inside the MyCar class you write a few lines to load the car graphic from the png file. When you want to compile, suddenly the HashMap/HasTable throws those weird errors.

    The only reason I'm using HashMap in the game is to link an object to an ID. I push an object with their respective ID in an custom object manager. I use it like this:

    var objects:HashMap = new HasMap(); // <-------- hashmap
    objects.insert(entity.GetID(),entity); // <--------- Insert objects from the game world with its respective ID

    Now if I don't use the HasMap/HasTable classes from polygonal labs everything runs ok, but those classes work ok as soon as I link the class to the sprite object in the library

    Has anyone tried using this AS3 Data Structure Library from polygonal labs ? sepecifically the HashMap and HashTable classes ?
    Last edited by ineedausername; 04-14-2009 at 03:24 PM.

  6. #6
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Honestly, that sounds like it's one of the weird fla corruption issues. Have you tried compiling with flex or flashdevelop? Since you're loading your graphic assets externally anyway, it shouldn't be a huge transition. And if you've got experience coding in other languages, both of those IDEs beat the pants off of CS3/4.

  7. #7
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Hrmm...this is bizarre - I'm getting the same errors when I just create a new HashMap(). Those methods are all accounted for but for some reason the interface is expecting them to be in a different namespace than public...and on top of that the internal classes below (grumble grumble) are also in the wrong namespace for their respective interface.

    This is extremely screwy - I'm not sure why using this in a linked class would affect anything but I suggest you use a different data structure for now. I'm not sure what your needs are but you could probably use an object or a Dictionary for similar results.

    Anyone else have any insights on this? Here's a paraphrase:

    PHP Code:
    //  error
    1044: Interface method get size in namespace de.polygonal.ds:Collection not implemented by class de.polygonal.ds:HashMap
    PHP Code:
    public interface Collection{
        
    // ...
                
    function get size():int;
        
    // ...

    PHP Code:
    public class HashMap implements Collection{
        
    // ...
        
    public function get size():int{
            return 
    _size;
        }
        
    // ...


  8. #8
    Junior Member
    Join Date
    Apr 2009
    Posts
    16
    So it seems the culprit was the HashMap/HashTable class after all.

    Still, those errors are confusing and if I link the class to the sprite inside the Flash Environment the compiler doesn't show any errors.

    I think I'm creating my own associative container class but it would be helpful if someone figures out what he hell is going on.

  9. #9
    Junior Member
    Join Date
    Jun 2009
    Posts
    1

    My solution

    I had the same problem it was because my class was a Singleton and because it had a SingletonEnforcer class in the same file. For some reason it doesn't like this and complained I didn't implement the interface when I damn well did.
    See http://blog.webdeely.com/author/admin/

    I just did a new way of using the Singleton..
    private static var _instance:MyClass = new myClass();
    See http://life.neophi.com/danielr/2006/...rn_in_as3.html

    Maybe thats your issue or something similiar.
    I didn't read so close.

  10. #10
    Junior Member
    Join Date
    Feb 2013
    Posts
    1
    i guess that getters and setters are not to be defined in interfaces...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts




Click Here to Expand Forum to Full Width


HTML5 Development Center