A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Having trouble saving an xml file on local host machine

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    6

    Unhappy Having trouble saving an xml file on local host machine

    Hi,
    I m kinda new to flash and actionscript 3.0. I have an actionscript file which provides me with xml data. But I m not being able to save it to the local host machine. The code i m using to save the file is just the normal one i.e

    var xml : XML = <save><instruments/></save>;
    var fileRef:FileReference = new FileReference();
    fileRef.save(xml,"NewFileName.xml");

    I've tried saving the data as byteArray first n saving it in a xml file. That didnt work. I've flash player 10 installed and I m working in Flash Professional CS5. I have also used a hex editor and changed my swf file's 7th and 8th bits from 09 to some A0 as directed in a website but I m always getting an error which is

    1061: Call to a possibly undefined method save through a reference with static type flash.net:FileReference.

    also m using this as response to a event, a button being clicked. The whole code has other packages used and hence m not pasting the entire code here. Please help me out guys

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Please use proper grammar. "m", "n", "u", and "r" are letters, not words.

    The local machine is the client, the host machine is the server. FileReference.save attempts to save to the client machine. Is that what you want?

    You are getting that error message because you are publishing to flash 9. The save method was not added to FileReference until flash 10.

    You should not need to change the data to a ByteArray. save can take XML just fine.

    You also should not need to manually flip bits in a swf. If you need to have local filesystem access in your published swf, just set that preference before publishing it. But that should not have any bearing on this problem, since that setting applies when testing and accessing resources on the local filesystem as opposed to over the network.

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    6
    Thank you.....I changed the settings in Flash so that it publishes to flash player 10 and it is working now

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