6 Replies Latest reply on Jun 19, 2006 11:00 AM by ntsiii

    More tutorial problems

    Level 7
      In another tutorial I get the following compile error:

      Error /tutorials/tutorial2.mxml
      A file found in an source-path must have the same package structure '',
      as the definition's package, 'samples.contact'.

      There is a file called Contact.as, but I don't know where it should be
      located to be in a flex classpath.

      The file tutorial2.mxml contains the line:

      import samples.contact.Contact;

      Anybody know how to solve this problem?

      Doug
        • 1. Re: More tutorial problems
          ntsiii Level 3
          I think Contact.as must have its packge defined :
          package samples.contact {

          Does it? I am just getting used to this package concept myself.

          Tracy
          • 2. Re: More tutorial problems
            Level 7
            Yes you are right I think (can't be absolutely certain as I still have
            an error). Adding the mxml files to a correctly defined project (see
            below) gets rid of the error I had before.

            I am confused though about the difference between a project and a package.

            I have found that if I use the same name for an mxml file in different
            projects, any errors that occur in either file are all shown in the
            problems panel when either file is selected, and neither will run. Both
            generate a page can't be found error e.g. tutorial1.html cannot be found
            (followed by the location) whereas I can see that this file definitely
            does exist at this location. Deleting either of the files allows the
            other to run correctly.

            In the project definition, I had to change from the default server
            (default\flex) to default\samples - I think this is what the tutorial
            writer means when he talks about a 'samples web application'.

            For anyone else trying to follow these tutorials:
            Put the Contact.as file into a contact folder in the default\samples
            directory and then in that file and any other mxml file where it is
            mentioned, change samples.contact.Contact to just contact.Contact.

            However, I still have an error:

            In the completed1.mxml file downloaded from MM, there is the following code:

            public function changeHandler(event:ObjectEvent)
            {
            log.text = noteProxy.noteText;
            }

            This generates the error:

            Type was not found or was not a compile-time constant: ObjectEvent

            I think this tutorial was written for an earlier beta and has not been
            amended to reflect the changes in later betas. It looks as though there
            is no longer a type called ObjectEvent in beta3. Does anyone know what
            this should be changed to?

            Doug
            • 3. Re: More tutorial problems
              Level 7
              I seem to have overcome the ObjectEvent problem by changing this type to
              Event. Whether this will ultimately work or not I don't yet know, as I
              still have a problem.

              In my last post I wrote:

              > I have found that if I use the same name for an mxml file in different
              > projects, any errors that occur in either file are all shown in the
              > problems panel when either file is selected, and neither will run. Both
              > generate a page can't be found error e.g. tutorial1.html cannot be found
              > (followed by the location) whereas I can see that this file definitely
              > does exist at this location. Deleting either of the files allows the
              > other to run correctly.

              The errors from two same named files from different projects all
              appearing in the problems panel for either file is NOT connected to the
              error 404 problem.

              I am still getting this problem and I think that although the required
              html file is at the location shown, it is derived from the server 'flex'
              whereas I think it should be using the 'samples' server.

              I have changed every server reference from flex to samples that I can
              find in the project properties and this has certainly allowed the file
              to compile with no errors, but it seems that something above the project
              level is still pointing the browser to the flex server.

              Does anyone know how to solve this problem?

              Doug
              • 4. Re: More tutorial problems
                Level 7
                Having now read through most of the help files in Flex, I now understand
                what a project is and can see that it is nothing to do with packages
                which are just collections of classes.

                I also realize that the problems panel displays the errors in any file
                in any open project. I didn't know that you can close projects that are
                not being used to stop irrelevant errors showing up. (File/Close Project).

                These tutorials were I think not written for AS3, so I have stopped
                trying to get them to work.

                What would help a lot is a list of all the properties in AS2 that are
                not included in AS3 each with a list of the possible alternatives that
                could potentially serve the same purpose in AS3.

                For example in the 'Use ColdFusion Event Gateway Adapter' tutorial
                (which I would particularly like to get working) there is the following
                line:

                import mx.messaging.messages.Message;

                But there is no Message property in mx.messaging.messages in AS3. Anyone
                know what this should be changed to?

                In addition, the following lines generate a weird error:

                pro = new mx.messaging.Producer();
                pro.destination = "gateway1";
                pro.resendAttempts = 5;
                pro.resendInterval = 5000;

                resendAttempts and resendInterval are valid read/write properties of
                mx.messaging.Producer, and yet generate the error:

                Access of possibly undefined property resendAttempts through a reference
                with static type mx.messaging:Producer.

                and the same for resendInterval.

                destination, which is inherited from a superclass, does not error, yet
                it otherwise looks to be identical to the other two in the way it is to
                be used.

                Anyone know how to solve this error?

                Doug
                • 5. Re: More tutorial problems
                  Level 7
                  P.S I have tried changing this (since the error implies that these are
                  static properties):

                  > pro.resendAttempts = 5;
                  > pro.resendInterval = 5000;

                  to this:

                  mx.messaging.Producer.resendAttempts = 5;
                  mx.messaging.Producer.resendInterval = 5000;

                  but the error is unchanged.

                  Doug
                  • 6. Re: More tutorial problems
                    ntsiii Level 3
                    Check out this page ofr some good resources for migrating:
                    http://labs.adobe.com/wiki/index.php/Flex:Migrating

                    Note especially the Migration Guide pdf, the Actionscript 2 to 3 comparison, and the Tips for Learning Actionscript.

                    Tracy