4 Replies Latest reply on Aug 1, 2006 7:44 AM by Renaun_Erickson

    .mxml file name makes app fail

    cheftimo Level 2
      I have been using Aral Balkan’s Flex Quick Starts as an aid in Learning Flex, and first, I would like to opine that this man’s tutorials are the best I have seen in my entire involvement with Flex – not one word is wasted in these lessons (I don’t even recall seeing the word “rich” anywhere) and they are put together in a way that makes you think and figure things out on your own, just searching through the Flex Help – highly recommended for us newbies!

      Now, here is a weirdo, if I ever saw one:

      To study the lesson titled “Defining state transitions”, in FB2 I created an application file named “transitions.mxml”, into which I wrote the code. When I got through, the Problems window kept showing this message:

      “Type was not found or was not a compile-time constant: transitions. [Generated code (use –keep to save): Path: transitions-generated.as, Line: 265, Column: 14]” - (looks like Greek to me).

      Double-clicking on this line of the Problems window resulted in selection of the <mx:Application> tag in the code window, sometimes the opening, sometimes the closing tag, with no reference to a line number.

      I searched my whole computer for a filename “transitions-generated*”, with zero results. I did find a few files with “transition” in the name and found some (all .as files) in Flash MX and Flash 8 folders and only one anywhere near Flex – Transition.as in C:Program Files\Adobe\Flex Builder 2\Flex SDK 2\frameworks\source\mx\states.

      After looking at the code with a microscope a couple of times and finding no errors and beginning to think Aral had missed something, I renamed the mxml file and voilá, the error was gone and everything worked fine. I have tried renaming the file (two or three times) back to “transitions.mxml” and the error appears again. With the new name, everything still works perfectly.

      I have read about reserved words, but never in connection with file names. Is this something we have to be concerned with? If so, I would love to be pointed to some place where one can research it. Or, is this a bug?

      I might mention that I ran into the same exact problem with a CFC I created in Dreamweaver 8 a couple of months ago, where renaming the CFC fixed all the problems; I don’t remember the particulars, except that the name was NOT “transition’ or anything like it.

      Any light on this subject would be greatly appreciated.

      Carlos
        • 1. Re: .mxml file name makes app fail
          leotemp Level 1
          dont name them that.
          • 2. .mxml file name makes app fail
            cheftimo Level 2
            leotemp, that's a very smart(***) answer - but don't name them what? I read your earlier post of today: you might benefit by looking at Aral Balkan's Quick Start about skinning the components.

            I have not seen anything in all the documentation about names to avoid in naming files. If there are restrictions on this, it would be nice to see a list of those names and the situations in which the restrictions apply. I would think renaming the file is not the first thing a programmer does when an unusual message shows up in the Problems window in FB.

            If anyone has something to say about this, please do so. Cheers,

            Carlos
            • 3. Re: .mxml file name makes app fail
              inlineblue Level 1
              When compiling an MXML file, it first gets converted into an .as file. In your case, that generated file gets named transitions-generated.as. It gets erased afterwards unless you use the -keep compiler flag (ie. "use -keep to save"). I think what you're seeing here is just one of those things that slip through the cracks. The code is being generated in a way that's causing a naming conflict. You've probably bumped into a specific combination of class/file names that's doing this, so it's most likely a bug. So, in a way, the best advice is "don't name it that". :-) And perhaps forward the bug to Adobe.
              • 4. .mxml file name makes app fail
                Renaun_Erickson Level 1
                Does there happen to be a function named "transitions" inside the "transitions.mxml"?

                Renaun