3
votes

All,

I'm pretty new to AS3, so this is probably a very trivial question. But, I'm stuck.

I'm working on a new Flash application (AS3). The app uses a Document class.

Here's how I've set up the folder structure:

  • "application" folder
  • "com" folder

    • "[mycompany]" folder

      • "[myproject]" folder

So, in Flash CS5, in the main FLA, the Class: field points to "com.mycompany.myproject.AppName"

If I click the little "pencil" icon next to that field, Flash CS5 loads AppName.as in the IDE.

In AppName.as, the first few lines are:

package com.mycompany.myproject {
    import flash.display.Sprite;
    public class AppName extends Sprite {

When I test the movie, everything works just like I'd expect. So far, so good.

However, when I try this on my HOME pc, it doesn't work - the constructor in AppName.as is never called.

There are no output messages or errors - just that nothing happens. Flash runs the SWF as though there was no ActionScript associated with it (there's no timeline code).

So, clearly, something is different on my home PC than on my office PC. But I can't figure out what.

Here's what I've ruled out:

  • The folder structure is the same on both PCs (I use dropbox, so I know they're identical)
  • In Flash CS5, I haven't set any global Source paths (i.e., Edit > Preferences > ActionScript > ActionScript 3.0 Settings - all path fields are blank). This is the same on both PCs
  • I have set the document specific paths on both PCs (i.e., in the Properties Window, if I click "Edit" next to ActionScript Settings, I get the "Advanced ActionScript 3.0 Settings" dialog window. In the "Source Path" tab, the only entry is ".". I assume that this means that Flash will find all source files in or below the folder that contains the FLA/SWF.

The strange thing... on my home PC, when I'm in Flash CS5 - if I click the little Pencil icon next to the Class: field, AppName.as loads in the IDE. So, it's as though Flash knows where to find the document.

The only problem is that, when I test the movie, the constructor is not called.

I know there are no errors in that Class, since it works perfectly on my office PC.

But, just to be sure, I reduced the Class to this:

package com.mycompany.myproject {
    import flash.display.Sprite;
    public class AppName extends Sprite {
        public function AppName () {
            trace ("Working!");
        }
    }
}

On my office PC, I see "Working" in the output window when I test this; on my home PC, nothing.

Many thanks in advance for any insight or advice!

[UPDATE]

In response to several comments, here's screenshots of the various settings: enter image description here

Here's the full size image

4

4 Answers

1
votes

Removing the ".as" from the end of the class name should fix your problem.

The Flash IDE will assume the location of the file from the qualified class name.

1
votes

Here's something you could try: Go to your output window and click the little icon on the top-right just below the close button. In the menu that appears, go to Filter Level and set it to Verbose and try publishing again. Does that help?

0
votes

I know it's bad form to answer your own question, but I finally figured it out. It had to do with lettercase in the path.

Here's the details (just in case anyone else is interested)...

It turns out that on the computer I originally created the application on (my office PC), the path I used was:

  • "application" folder
  • > "com" folder
  • > - > "[mycompany]" folder
  • > - > - > "[MyProject]" folder

So, my document class begins:

package com.mycompany.MyProject {

As I mentioned, I use dropbox.

So, when I started up my home PC, dropbox automatically starts, and syncs everything.

However, here's what dropbox created:

  • "application" folder
  • > "com" folder
  • > - > "[mycompany]" folder
  • > - > - > "[myproject]" folder

Note that "myproject" is not capitalized the same way.

Apparently, the Flash IDE is not sensitive to case, which is why it was able to find the Class document (MyProject.as), when I tried to edit it. However, the compiler must be, so it was not able to find it.

As soon as I changed the "myproject" folder to "MyProject", everything worked great.

Sorry for such a stupid question.

0
votes

It's been a long time, but in case anyone encounter the problem again.

I've just experienced this problem today, and luckily I am able to identify my error. I mistakenly add ":String" and that cause Document Class to disappear from FLA.

if (floors = '') {
    floors:String = '{"floors":[{...'
}

by removing the shouldn't-be-there ":String", the Document Class is back in action.

if (floors = '') {
    floors = '{"floors":[{...'
}