A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: AS3 CS5 - "Name of Package ... does not reflect the location of this file" error

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    2

    AS3 CS5 - "Name of Package ... does not reflect the location of this file" error

    Hello,

    I am using Flash CS5, AS3 on a W7 machine.

    I'm a newbie to Flash and AS. I just finished Foundation Game Design with Flash with what I felt was no problems. I just started Advanced Game Design with Flash and hit a wall immediately. The book has a link to downloadable source code which I did download and then expanded. The book tells me I can pretty much place the source code anywhere I want as long as I -
    1. Set the path preferences for AS3 correctly and...
    2. Set up the file structure for each project properly


    I followed the instructions as closely as I am capable but I kept getting the following error -


    D:\Flash\AdvancedGameDesign\com\friendsofed\utils\ StatusBox.as, Line 1 5001: The name of package 'com.friendsofed.utils' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. D:\Flash\AdvancedGameDesign\com\friendsofed\utils\ StatusBox.as


    Currently I have the preferences ActionScript - ActionScript 3.0 Settings - Source path set to -


    D:\Flash\AdvancedGameDesign\com\


    The package definition's name inside the file "StatusBox.as" is -


    Code:
    package com.friendsofed.utils


    The package "StatusBox.as" itself is located at -


    D:\Flash\AdvancedGameDesign\com\friendsofed\utils


    Obviously I don't have a very good grasp on packages and/or setting up paths in preferences. If someone could please help me understand what I am doing wrong I would dearly appreciate it. If any additional information is needed please let me know and I will do everything I can to get it on here. I do very much wish to continue with my learning but I've been beating this poor brain pan of mine against this wall for 3 days now.

    Thank you all in advance for your time and efforts!

    Best,

    Jay

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    change your actionscript source settings from:

    D:\Flash\AdvancedGameDesign\com\

    to

    D:\Flash\AdvancedGameDesign\

    As you probably read in the first book, class packages are a way of protecting your class from getting overwritten by another of the same name.
    Say you created a game package that had a class called Player at com/websiteA/Player.as. Now say you add someone's else's music playing package. Your unique folder path would protect it from say a Player class in their package at com/websiteB/Player.as

    When it comes to setting up targets to source code, you basically just point it to the parent folder just before the beginning of the package path

    So in your case you just point it to where the com folder is and since com is in the package name, it will take it from there.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    2
    Hi jAQUAN,

    Thank you for your prompt reply.

    As per your instructions I changed my actionscript source settings from:

    D:\Flash\AdvancedGameDesign\com\

    to

    D:\Flash\AdvancedGameDesign\

    ...to no avail. I got the exact same error message.

  4. #4
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    You have a space in the class name: ' StatusBox.as' - is this in error?

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