3 Replies Latest reply on Jul 25, 2007 11:44 AM by Newsgroup_User

    Using external casts on web?

    Applied CD Level 1
      OK, I’m a little confused. I’ve got 6 shockwave movies (.dcr) sharing an external cast (.cct) all in the same folder. Among other things the external cast contains font assets that are required in frame 1 of each movie.

      To make the movies reasonably portable from one server to another I’m assigning a global variable in the loader movie to the base URL and my preloads are accomplished as follows: gNetID = preloadNetThing(gBaseURL & “subfolders/nextMovie.dcr”) This way I only need to reassign gBaseURL in the loader and the rest of my links will follow.

      My problem is making this work with the external cast. I can’t simply use the internet button when attaching the cast because this will hardcode the URL. From what I understand I must preload the shared cast in the loader’s startMovie handler to download the shared cast to cache, then I need to link the shared cast in cache to the current movie using myCastLib = _movie.castLib["shared"] followed by myCastLib.filename = gBaseURL & “subfolders/shared.cct”. All of this must happen before frame one. Here’s where I have a problem. If myCastLib.filename is given a URL will it still pull the data from cache? The docs aren’t very clear about this. Repeat loops waiting for netDone() don't seem to work very well, do I have to wait in at least frame one of the loader? (this wouldn't be an issue with the other movies as the shared cast will already be downloaded) Also, it looks like castObjRef.filename can only be used to reassign the source of an existing cast, not attach a new one. Am I missing something here? This has got to be a fairly common task yet it’s looking awfully complicated … is there an easier way to link to external casts?
        • 1. Using external casts on web?
          tedalde2 Level 2
          You don't need absolute paths for preloadNetThing, so you can get rid of gBaseUrl. Just use relative paths. You might move your sprites out some distance from frame 1 so you have time to check and load the external cast. Don't use a repeat loop to test netdone()... it's too tight. Use a timeout or check it on exitframe. Usually I just use a frame behavior that tests netdone() on exitframe. If unfinished, _movie.go(_movie.frame - 1) to check it again. Once the cast is finished loading, then set the .filename property of the cast (myCastLib.filename = "subfolders/shared.cct"). The browser should know that it is now a local cast... if not simply try ... = "shared.cct"... but I think the former is correct. And yes, you can only set the filename of an existing cast. You can't create new casts on the fly.
          • 2. Re: Using external casts on web?
            Applied CD Level 1
            Thanks, it's still giving me trouble though. I've isolated the problem to preloadNetThing, I'm going to start a new thread in case someone else has seen the same error code.
            • 3. Re: Using external casts on web?
              Level 7
              look up using a dswmedia folder. You have to copy your project into a
              dswmedia folder before shocking then copy everything up.


              "Applied CD" <webforumsuser@macromedia.com> wrote in message
              news:f87v12$erl$1@forums.macromedia.com...
              > Thanks, it's still giving me trouble though. I've isolated the problem to
              > preloadNetThing, I'm going to start a new thread in case someone else has
              > seen the same error code.