14 Replies Latest reply on Apr 7, 2008 2:57 PM by Newsgroup_User

    importFileInto error -2147216668

    saumier
      I am using preloadNetthing/importFileInto to load images from URLs in shockwave. It works well for many jpgs. However, I get the following error "Problem reading file http://home..." -2147216668 for a specific type of URL. When I type this URL in the IE browser window it works fine.

      Here is a very easy way to reproduce the problem in the Director (authoring environment).

      put member(25).importfileinto(" http://home3.mvm.com/compositorro?v=4&im=y&a=1&q=090&789C9D914D7382301086FF0D47B201F1E3C08 1DA5A3B75AC235E7ADA09103E2C980C6099FEFB8650C5CEA0759A0CB061B2CFEEBE6FEC065978548F51B97B991 8A93B02301A974E66067749D334A4F82C882CC59E8775455251706C385052653527691D89B02259C1125E9198E 579C0C20FB325497991AE7EEA1B52C863CEEA4C1C2A62C864E046C2CA821F2E2AD9C4C86E34620F35122408D4A C136664AA8B05A1D40493923817A2AC521689E6DCB23AE2426D8A305E3EFAEAABF664864A06532A597E0102117 D9D6BA858677679EB570BFD39507CD86E71B1A3E86D2C5CBDC0E83631E52C3A11DB5813E79EE26898F76C013EB D7BB87EF371B5D9E932C3D4C06D2521AD4A5A9B184B9E433B56AFA9A5973E6317B714B0E1DAF0C91D50AA5707E D62B4D0027A52D4FA4FA77F41AF769A163D6FDAF31C67EC8C7E26EF6205980238F7D89EB2AC3C9BA4626DD2D20 71B9773F5D27669A75A77E8A03FDF138712EC")

      I really need to load this URL because it is the core of my project and it needs the long URL because the server is actually generating the jpgs on the fly. The problems occurs with all different URLs from from this server.

      Any ideas?

        • 1. Re: importFileInto error -2147216668
          Level 7
          The UIHelper xtra provides a global method that (not often) translates
          these large negative numbers into more meaningful error messages. In
          your case you got lucky:
          put MOAErrorToString(-2147216668)
          -- "MOA stream2 error: Cache download stopped"

          However, this doesn't tell you why the error occurred. Is the MIME type
          being correctly added by the server? You could use a packet sniffer to
          examine the headers returned.

          In the authoring environment, try downloadNetThing()ing the file to a
          local file and make sure it completes successfully, then examine the
          resulting file externally to Director. Then you could importFileInto().

          Or perhaps you're trying to import the file before the download is
          completed. You realise that preloadNetThing() and downloadNetThing() are
          asynchronous and that you have to wait for them to complete before
          importing any result?
          • 2. Re: importFileInto error -2147216668
            saumier Level 1
            I was able to downloadNetThing() and use the importFileInto() from the local disk. However, I need to get the URL from shockwave so I need to use the preloadNetThing().

            I still have the problem that preloadNetThing(URL) completes asynchonously (I do wait for netDone() = 1) and then when I try to importFileInto(URL) the result is 0 indicating that the importFileInto(URL) operation failed. This happens both in authoring mode and in shockwave.

            I really appreciate your input - I've been developing Director aps for years and this is really stumping me. Thanks in advance.
            • 3. Re: importFileInto error -2147216668
              Level 7
              That's too wierd that downloadNetThing() works while preloadNetThing()
              fails.
              AFAIK, preloading places the asset in your system's %temp% directory so
              perhaps you could wait for netDone() to complete against your preload
              and check the file in your temp folder to see if it's "intact". That
              would perhaps help determine whether it's the import that's failing or
              the preload.
              Again I'd recommend using a packet sniffer (like PlasticSniffer:
              < http://www.plasticwater.com>) and check the headers of the file
              returned by your server to make sure it has the MIME type and perhaps
              content-length correctly set.
              • 4. Re: importFileInto error -2147216668
                Level 7

                "saumierfinch" <webforumsuser@macromedia.com> wrote in message
                news:ft5i4k$cd0$1@forums.macromedia.com...
                >I was able to downloadNetThing() and use the importFileInto() from
                >the local
                > disk. However, I need to get the URL from shockwave so I need to
                > use the
                > preloadNetThing().
                >
                > I still have the problem that preloadNetThing(URL) completes
                > asynchonously (I
                > do wait for netDone() = 1) and then when I try to
                > importFileInto(URL) the
                > result is 0 indicating that the importFileInto(URL) operation
                > failed. This
                > happens both in authoring mode and in shockwave.
                >
                > I really appreciate your input - I've been developing Director aps
                > for years
                > and this is really stumping me. Thanks in advance.
                >

                Did you try with a text file and a hardcoded short URL?
                Did it work?
                Then try a longer one until it stops working.

                Your URL maybe be too long for the engine to handle.
                Did you check?

                Richard.


                • 5. Re: importFileInto error -2147216668
                  Level 7
                  757 characters does seem excessive. I thought the limit was 255?
                  • 6. Re: importFileInto error -2147216668
                    saumier Level 1
                    I seem to be on to something. I checked with HTTPWatch and the MIME type and length are set correctly.

                    However, I realised that there is no ".jpg" at the end of my URL because it is generated dynamically.

                    When I use the downloadNetThing() I created the local file with the extension .jpg. But when I use the preloadNetthing() there is only the original URL. When I use the URL to importFileInto(URL) with no ".jpg" at the end it fails. I tried addind a bogus &toto=image.jpg at the end of the URL to no avail.

                    If this is true it means that importFileInto(URL) cannot be used with any dynamic content. So I testing callng a static jpg on a server with the incorrect file extension and I had the same problem.

                    Please tell me I am wong!
                    • 7. Re: importFileInto error -2147216668
                      Level 7
                      You probably should not be using ImportFileInto. That function is
                      intended to aid in authoring your movies. It's use in published movies
                      is not officially supported, though I am sure some developers do it.

                      Since you know the path to the file on the local disk, why not just use
                      the fileName cast member property to create a linked image?
                      • 8. Re: importFileInto error -2147216668
                        Level 7

                        "Dave C" <no@no.com> wrote in message
                        news:ft644o$31j$1@forums.macromedia.com...
                        > 757 characters does seem excessive. I thought the limit was 255?

                        Google knows probably... ;)

                        R.


                        • 9. Re: importFileInto error -2147216668
                          Level 7
                          I'm with Dave on this. The first thing to try is preloadNetThing()ing
                          your file and then setting the filename of an existing (or new) bitmap
                          member to the URL. Then check the member.type and dimensions.
                          I tried testing your URL myself, but I get a netError of 4836: "Download
                          stopped for an unknown reason, possibly a network error, or the download
                          was abandoned."
                          • 10. Re: importFileInto error -2147216668
                            saumier Level 1
                            I cannot use a local file because my project must run in a shockwave and must call a URL to generate images on the fly.

                            I tried to call a static jpg file using a long URL with about 800 chars and it worked no problem. I used preloadNetThing() and then Importfileinto and it worked.

                            The only other thing I can think of that could be causing the problem is that the image may be flagged as "do not cache".

                            I don't understand how it can be so difficult to call a URL from Shockwave! Dave C. suggests to not use ImportFileInto at all and that it is not officially supported!! Anyone else have that feeling?

                            In desperation I created a Flash that can easily import the file and now I am trying to load the flash into Director as a widget to get the job done.

                            I am still baffled that such a powerful tool as Director has trouble with URLs. I would really prefer doing my project fully in Director/Shockwave.
                            • 11. Re: importFileInto error -2147216668
                              Level 7
                              Why don't you at least try what Dave and I have suggested?
                              -- pseudocode:
                              tUrl = "<your JPEG URL>"
                              aNetID = preloadNetThing(tUrl)
                              -- wait for netDone(aNetID); check netError(aNetID)
                              -- if done = 1 and error = "OK" then
                              tMember = member("bitmap")
                              tMember.filename = tUrl
                              put "file imported:", tMember.type, tMember.width, tMember.height
                              put tMember.filename
                              • 12. importFileInto error -2147216668
                                saumier Level 1
                                I have tried it, and everything is OK until tMember.filename = tUrl at which point the member is empty.
                                • 13. Re: importFileInto error -2147216668
                                  saumier Level 1
                                  I have tried it, and everything is OK until tMember.filename = tUrl at which point the member is empty.
                                  • 14. Re: importFileInto error -2147216668
                                    Level 7
                                    There was a thread on Direct-L relating to the import of images
                                    generated by PHP with eventual resolution. You should perhaps read it.
                                    It was started on 22/11/2007 by Tomasz Luczynski and titled "problem
                                    with image exported by php"
                                    Here's part of it:
                                    <quote>
                                    unfortunately this doesn't help, director isn't that dumb, but correctly
                                    parses the URL and looks for the real file-ending

                                    the problem is that unfortunately director doesn't care for the sent
                                    mime-type, but recognizes the filetype from the file-ending (.php in
                                    your case).
                                    AFAIK the only workaround is to rename your PHP-script to *.jpg
                                    (imgexp.jpg), and put a .htaccess-file into the same folder that
                                    contains the single line:
                                    AddType application/x-httpd-php .jpg
                                    </quote>
                                    <quote>
                                    however changing the extension of php script to 'jpg' with 'AddType'
                                    directive in htaccess caused 500 internal server error. So I added
                                    another directive (rewrite rule) that translates all jpg requests to php
                                    requests.


                                    In lingo we use invocation:
                                    http://warkawspierakluby.isens.biz/kreatorFlag/imgexp.jpg (there is no
                                    such file on http server)
                                    instead of:
                                    http://warkawspierakluby.isens.biz/kreatorFlag/imgexp.php


                                    lingo:
                                    [code]
                                    imageMember = _movie.newMember(#bitmap)
                                    imageMember.fileName=
                                    " http://warkawspierakluby.isens.biz/kreatorFlag/imgexp.jpg"
                                    channel(6).makeScriptedSprite(imageMember)
                                    [/code]


                                    and .htaccess in folder ' http://warkawspierakluby.isens.biz/kreatorFlag/'
                                    :
                                    [code]
                                    RewriteEngine On
                                    RewriteRule ^(.+)\.jpg$ $1\.php [L]
                                    AddType application/x-httpd-php .jpg
                                    [/code]


                                    php file ( http://warkawspierakluby.isens.biz/kreatorFlag/imgexp.php)
                                    remains the same (we don't change extension of the file)
                                    [code]
                                    <?
                                    header("Content-type: image/jpeg");
                                    echo file_get_contents
                                    ("./flagiDoZaakceptowania/tomek/1191309052_flaga.jpg");
                                    ?>
                                    [/code]
                                    </quote>