A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Local and Remote image loading

  1. #1
    Member
    Join Date
    Nov 2000
    Location
    South East UK
    Posts
    91

    Local and Remote image loading

    Hi I've noticed a weird situation with Flash Lite 2.1 in regards to loading images. The application I'm developing needs to load from both the local file storage system as well as via the data connection to a webserver.

    What is strange is that when the code below is run, the local file loading buttons work fine until the user clicks the other "remote asset loading buttons" , which call to the ones on the webserver. After that local file loading does not work at all, even though it did before!

    My guess is that perhaps I should add something like "file:\\" onto the local one, but haven't a clue what the path might be on the PocketPC to local areas (e.g. storage card etc), hence the local asset is currently in the same folder as the flash lite .swf file.

    createEmptyMovieClip("image1",1)

    buttonLocal1.onPress=function(){
    trace("loading from local");
    image1.loadMovie("localimage1.swf");
    }
    buttonLocal2.onPress=function(){
    trace("loading from local");
    image1.loadMovie("localimage2.swf");
    }
    buttonServer1.onPress=function(){
    trace("loading from server");
    image1.loadMovie("http://www.domain.com/assets/serverimage1.swf");
    }
    buttonServer2.onPress=function(){
    trace("loading from server");
    image1.loadMovie("http://www.domain.com/assets/serverimage2.swf");
    }

    Anyone got any ideas on this?

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    I dont have info on why this would happen, but what happens if you delete and recreate the movieclip on each button press? Perhaps this might clear out whatever issue is preventing the local file load.

  3. #3
    Member
    Join Date
    Nov 2000
    Location
    South East UK
    Posts
    91

    Great!

    Brilliant - Thanks HP3, your suggestion was the answer, changing the code to remove, then create the movie clip in each function before the load made it work consistently

    removeMovieClip("image1");
    createEmptyMovieClip("image1",1);

    Now each loads flawlessly from either location.

    What a strange flash bug!

    Now thats solved, I'd still be interested if anyone can help define what the path to a PocketPC storage card is as an "absolute path", so I can store images wherever I like locally on the handset for loading from the app, rather than just the folder or sub-folder where the main .swf is run from.

  4. #4
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    you could try loading a swf from the memory card and tracing getUrl() to see if it gives you the full file path, and use that as a reference.

    Unfortunately, these file paths tend to change with different OS releases.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center