Skip to main content
Participating Frequently
September 22, 2009
Answered

A file found in a source-path must have the same package structure

  • September 22, 2009
  • 4 replies
  • 10546 views

HI,

I'm creating an application. What i did to generate this error, was to seperate my AS3 code to another .as file in the same folder. Since then, i'm getting this error. I tried a couple of different things like creating a new folder under the same structure with the name same as the package i declared. However, no effect, its gave the same error.

I searched the information about this error, all suggested the same thing....that i have done. Probably i'm not getting what they all have been saying.......

however, can somebody explain where i'm going wrong about this ???????

Thanks & Regards

H.R.

    This topic has been closed for replies.
    Correct answer paul_williams1

    My guess is you put it in the right place, and the 'bunch of different errors' that you refer to are compilation errors in your class. In its current location, Flex won't compile your class because it is in the wrong directory, so you won't see these errors. Put it back where it should be and if you get more errors that you do not understand, look them up with google, read the actionscript docs or ask another question on the forum.

    4 replies

    September 23, 2009

    Hi,

    Based on your answers:

    What's the name of your Class as declared in the .as file?  ---- myclass

    What's the filename of the .as file? -- myclass.as

    What's the name of your package as declared in the .as file? -- myApp

    What's the path to the .as file?    -- D:\Work Space\ABC\src

    You say your package declaration is:

    package myApp
    {

       public class myClass {}

    }

    But it is located within the D:\Work Space\ABC\src folder

    This is not how it should be done. The package declaration must be conform your folder structure. If your main source folder was D:\Work Space\ABC

    then your package declaration should be

    package src {}

    If your main source folder was D:\Work Space\ABC\src then your package declaration should be

    package {}

    Hopes this helps

    Jan

    Participating Frequently
    September 23, 2009

    Sorry, i didn't post it earlier....... i have tried the same you suggested.

    I mean creating the folder with same name as the package inside the SRC folder and creating putting the .AS file inside it with same name as the classname that is the default way how flex builder creates the .AS file.

    However, when i did the same, flex threw a bunch of different errors, that's why i placed it again to the same position where it was not giving error.

    thanks

    paul_williams1Correct answer
    Participant
    September 23, 2009

    My guess is you put it in the right place, and the 'bunch of different errors' that you refer to are compilation errors in your class. In its current location, Flex won't compile your class because it is in the wrong directory, so you won't see these errors. Put it back where it should be and if you get more errors that you do not understand, look them up with google, read the actionscript docs or ask another question on the forum.

    Participating Frequently
    September 23, 2009

    someone..................!!!!!!!

    Participating Frequently
    September 22, 2009

    anyone??????????

    Participant
    September 22, 2009

    What's the name of your Class as declared in the .as file?

    What's the filename of the .as file?

    What's the name of your package as declared in the .as file?

    What's the path to the .as file?

    You could also use FlexBuilder to create your class or a new class in the same package, using "File->New->ActionScript Class". This may give you more clues about what's wrong.

    Participating Frequently
    September 23, 2009

    Well, this was the same method i used to create the AS  class "File->New->ActionScript Class".

    Right now, i have the PROJECT folder and all the default folders are under it. The .as class file is placed under the SRC folder and i'm still getting the error. Other than this error, i'm also not able to access 2 methods out of 5 inside the class. Can it be becuase of this error??

    Thanks

    September 22, 2009

    Hi,

    You have copied or moved your .as file from one folder to another,but still at the top of the .as file there is the older package name.

    So please go to each and every .as file which you have move and check theri package name.One shortcut for this is that go to the

    as class,remove old package name,and press cltrl + space bar where your old package name was.It will take the new package name.Apply same for all the classes which you have moved so all pakage name will be updated one by one.

    Let me know if you can fix it by doing one by one.

    with Regards,

    Shardul Singh Bartwal

    Participating Frequently
    September 22, 2009

    Hi,

    Also i tried what you suggested. To remove the package name, then Ctrl + Space, however it did not suggest anything.

    This is what i did. Earlier the .as file was in the SRC folder. This time. i created a new folder, under the same folder as SRC folder was. Named the new folder same as the package i declared and tried compiling again.

    This didn't work.