A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: package problem

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    5

    package problem

    hello i´m trying to import a custom version of the simple button but i cant find the problem it says : "Type was not found or was not a compile-time constant:"
    can anybody have a look at it and tell me the mistake? i´m still confused with packages and import stuff in flash.

    heres the link to my project:http://drop.io/rsfcg7f1313/asset/flashproject-zip

  2. #2
    Member
    Join Date
    Sep 2010
    Posts
    61
    If I'm seeing everything correctly, you don't have a CustomSimpleButton in your library.

    Make an object called CustomSimpleButton.

    Also, this is personal preference but instead of using a component, I'd just make a button or movieclip symbol the way you want it and import that.

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    thank you but i tried this already and the button works fine when all classes are in the same folder, this shouldn´t be the case if that was the problem i guess...

  4. #4
    Member
    Join Date
    Sep 2010
    Posts
    61
    I don't mean to patronize you, but all the classes do need to be in the same folder, or else you need to reference what folder they are in at the top of the class.

    So if, for example, your Main class is in the root folder, and you have a Shooter class inside a fold called Enemy which is inside a folder called Stuff you'd have to import the class with...

    Actionscript Code:
    package stuff.enemy

    //Imports and other code
    {

    Again, I'm not trying to patronize you, but have you done this?

    (If I'm wrong, someone please correct me. I'm still learning but I'm trying to help others in the process.)

  5. #5
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    well of course i told flash in which package the component lies.. thats why i cant see why it doesnt work...

    ok for others:
    my code is something like this:
    Code:
    package {
        import flash.display.Sprite;
        import flash.display.DisplayObject;
        import components.CustomSimpleButton;
    
        public class SimpleButtonExample extends Sprite {
            public function SimpleButtonExample() {
                trace("start");
                var button:CustomSimpleButton = new CustomSimpleButton();
                 addChild(button);
            }
        }
    }
    i also tried to "Make an object called CustomSimpleButton." and put it to the library. the object was correctly linked to my as code ( if i clicked on properties of the object and clicked then on the linked as class the correct class was opened.
    still it said the same error..

    PLS can anybody with some more plan than me have a look at it? i guess it would be 5 minutes maximum for anybody with some little experience i try to find the bug since 3 or 4 days...

  6. #6
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    ok i have the error:
    the classes where not public, which i totally overlooked as i copied it from an official example...

    the coding support of flash is really awful or better said not existant they should work on things like codecompletion and class prefabrication.. i mean if fdt has it why does a really expensive programm like flash miss it...

  7. #7
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    I have yet to find if the developer docs are in flash CS5; they're not in the help anymore like they used to be I know that. And that's a shame. But the online docs are very good, and cs5 does have lots of help with code completion, snippets, and such. So, I'd say they're getting better. Flash builder running on eclipse works really well. That was a smart move for Adobe in my opinion.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  8. #8
    Junior Member
    Join Date
    Sep 2010
    Posts
    5
    well im working in cs3 but i´m usually coding in java and i really think they could take a big bit of the help that is available there in eclipse.

    if i´m correct (at least in some other forum thex told me i am) flash does not help you with custom class code completion also automatic import would be nice. i mean come on at least their own classes.

    i don´t want to think how much time end nerves if you type something wrong etc i waste with this stuff.
    i think it would be much easier for me to learn flash.. i found it easy when i worked with mx some long time ago ^^ but now i learned java in the meanwhile and tried to come back for a pretty important project (the last thing i need for getting my bacchelor title) and it´s soooo annoying.. somehow i can´t get off my java habits ^^ and i always type the wrong commands XD

  9. #9
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    Fortunately for you flash and java are starting to look more similar than ever. There is code completion for custom classes (in cs5) but not in cs3. I think they were more worried with trying to get a running version of AS3 together into the IDE than with trying to trick it out. CS3 has some things I miss, like the old help document and the feel of the layout, but flash builder built into eclipse is much more helpful than cs3 ever was. And, coding in the flash IDE is a lot nicer than it's ever been as well; if you strip down all the animator/design windows. Importing all of your classes is a bit of a pain but after you've been doing it that way already for several years then you know what needs to be imported and what doesn't. Anyway, none of what I said helps you really or helps with your initial problem that's already fixed but I wanted to defend flash just a little bit. I get on the other side too and do some bashing now and then. Good luck.
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

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