3 Replies Latest reply on Jul 19, 2007 5:20 AM by Newsgroup_User

    Flash Action Script - "include" error

    lucerias
      I got the following sample code from internet. I have installed the Marcomedia Flash Remoting for Flash MX 2004 ActionScript 2.0.

      When i ran the .swf in the folder, it worked fine. But if i reexport the .swf, the following error messages will occur.

      quote:

      **Error** Scene=Scene 1, layer=Remoting, frame=1:Line 2: Error opening include file NetServices.as: File not found.
      #include "NetServices.as"

      **Error** Scene=Scene 1, layer=Remoting, frame=1:Line 4: Error opening include file NetDebug.as: File not found.
      #include "NetDebug.as"

      Total ActionScript Errors: 2 Reported Errors: 2



      As a result, the .swf can't run properly. I believe the problem may be lying on the error shown as above and i even tried to replace them with

      quote:


      // for flash remoting
      import mx.remoting.NetServices;
      // for flash debugging
      import mx.remoting.debug.NetDebug;

      NetDebug.initialize();



      And it still couldn't solve the problem. May i know what is the solution? Thank you.
        • 1. Re: Flash Action Script - "include" error
          Level 7
          lucerias,

          > I got the following sample code from internet.

          > // for flash remoting
          > #include "NetServices.as"
          > // for flash debugging
          > #include "NetDebug.as"
          [lots of code, snipped]

          I'm with you so far.

          > When i ran the .swf in the folder, it worked fine. But if i reexport
          > the .swf, the following error messages will occuer
          >
          >
          quote:

          **Error** Scene=Scene 1, layer=Remoting, frame=1:Line 2: Error opening
          > include file NetServices.as: File not found.
          > #include "NetServices.as"

          The #include directive takes the code referenced in the quotation marks
          and effectively inserts it into the frame (or wherever this code appears) as
          if it had been typed or pasted there by hand. What this means, then, is
          that the files NetService.as and NetDebug.as must be present on your
          computer at compile time, so their contents can be added to the SWF.

          > I believe the problem may be lying on the error shown as above

          That's my hunch, too. You'll need to locate those files.

          > and i even tried to replace them with
          >
          >
          quote:

          // for flash remoting
          > import mx.remoting.NetServices;
          > // for flash debugging
          > import mx.remoting.debug.NetDebug;

          If the original code said to use #include, then #include it will have to
          be. The import statement is not interchangeable with #include. If you have
          classes (AS files) in a package accessible as mx.remoting and
          mx.remoting.debug on your computer, the above would only work if the
          NetServices and NetDebug class files were the same files used in the
          original code.


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."


          • 2. Re: Flash Action Script - "include" error
            lucerias Level 1
            i have alreadyinstalled the Marcomedia Flash Remoting for Flash MX 2004 ActionScript 2.0.
            I suppose it should be located by itself as long as the action script is written correctly.
            May i know how to locate the file properly?
            Thank you.
            • 3. Re: Flash Action Script - "include" error
              Level 7
              lucerias,

              > i have alreadyinstalled the Marcomedia Flash Remoting for
              > Flash MX 2004 ActionScript 2.0.

              I haven't used remoting myself, so I don't know what additional files it
              installs.

              > I suppose it should be located by itself as long as the action
              > script is written correctly.

              I would expect the same thing. If you're using the #include directive,
              you'll have to provide the full path to the file(s) desired unless they're
              sitting in the same folder as the FLA itself. If you're using the import
              statement, then the package(s) supplied or the class(es) desired must be
              referenced in your classpath settings, as described here:

              http://www.communitymx.com/content/article.cfm?cid=197DE

              > May i know how to locate the file properly?

              I wish I new more about Remoting. As it turns out, my experience with
              Flash and SOAP has always occurred via WebServicesClasses -- that is, a
              direct interface with web services, and not a remoting gateway. If may be
              that you have to drag a Component or two from the Components panel to the
              Stage in order for your ActionScript to be able to "see" the classes you've
              been describing. That's only a guess, though.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."