A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [CS3] Problem finding xml file

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    Question [CS3] Problem finding xml file

    I'm new at this so bear with me.
    The flash file that I'm using is not able to find the xml file when in a different folder.

    If I have a menu.htm, menu.xml and menu.swf in the same folder everything works great.

    What I want to do is have the files menu.xml and menu.swf in <scripts> folder that can be called from any other folder like <training> <root> or <guestbook>.

    so I have
    root
    -<images>
    -<scripts>
    -<guestbook>
    -<training>

    Here is what I have in html for flash
    <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="800" height="200" id="menu" align="middle">
    <param name="allowScriptAccess" value="sameDomain" >
    <param name="allowFullScreen" value="false" >
    <param name="movie" value="menu.swf" >
    <param name="quality" value="high" >
    <param name="bgcolor" value="#333333" >
    <embed src="menu.swf" quality="high" bgcolor="#333333" width="800" height="200" name="menu" align="left" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
    </object>


    Here is what I have for code in menu.fla
    var my_xml = new XML();
    my_xml.ignoreWhite = true;
    my_xml.load("menu.xml");


    I'm not sure what I'm missing.
    I fiddled with the htm page at set <embed src="../scripts/menu.swf" etc.
    That seems to help but the xml file isn't being found.

    I tried using the full url to where the xml file is.

    Any ideas?

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    If your xml and swf files are in the same folder ("scripts") then there shouldn't be an issue. Is the swf file viewable from the .htm? Btw, there are 2 address locations to be aware of in the object tag
    1. <param name="movie" value="scripts/menu.swf" > &
    2. <embed src="scripts/menu.swf" quality="high" bgcol...

    Maybe consider using javascript to load your swf.
    http://blog.deconcept.com/swfobject/

    HTH.
    Wile E. Coyote - "Clear as mud?"

  3. #3
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    Change the way u load XML file i.e.

    my_xml.load("../scripts/menu.xml");

    This shud solve the issue.
    As ever,
    Vinayak Kadam

  4. #4
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    Question [CS3] Problem finding xml file

    I modified the code
    <param name="movie" value="scripts/menu.swf" >
    <embed src="scripts/menu.swf"
    This worked in the case where the menu.htm file is in the <root> and the xml & swf file are in the <scripts> folder.


    I tried this senario - if the htm file was in <training> folder
    This should work but doesn't
    <param name="movie" value="../scripts/menu.swf" >
    <embed src="../scripts/menu.swf"
    The swf file is not viewable either.
    This is just simple html so I would think it should work.

    I also tried this senario
    I used a different swf file that was not dependent on a xml file to specify the menu structure for the swf file
    All the code mentioned above worked.

    I might try a JavaScript approach to load the swf file if all else fails.
    I also tried a code change in the flash file for
    my_xml.load("../scripts/menu.xml");
    I don't think that's it yet because I still should be able to at least view the swf file.
    Any ideas?

  5. #5
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    Try uploading the files and I'll have a look at it.
    Wile E. Coyote - "Clear as mud?"

  6. #6
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    [CS3] Problem finding xml file

    Here are the files I'm testing with.
    I tried deploying to a different web server to see if that is causing problems.
    It was to some extent.
    Basically the files will only work if the asp/htm, swf and xml are in the same folder. I can put the js file in a <scripts> folder. that works.


    See what you think.
    Thanks for the help
    Attached Files Attached Files

  7. #7
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    Think I got it working, have a look and see if it works for you.
    Last edited by Robb@exo; 07-31-2009 at 08:15 AM.
    Wile E. Coyote - "Clear as mud?"

  8. #8
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    Talking [CS3] Problem finding xml file

    Excellent. That does exactly what I wanted it to do. Thank you very much.
    I see the changes in the fla file for my_xml.load.("../scripts/menu.xml");
    In the asp you changed the lines of code
    <param name="movie" value="../scripts/menu.swf" >
    <embed src="../scripts/menu.swf"
    and some in the Javascript function AC_FL_RunContent.
    Was there anything else that was changed ?

  9. #9
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    No I think that was about it.
    Wile E. Coyote - "Clear as mud?"

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