www.webdeveloper.com
Results 1 to 10 of 10

Thread: Flash menu / XML help

  1. #1
    Join Date
    Feb 2009
    Posts
    5

    Flash menu / XML help

    I am trying to implement a flash menu on my website. I've never done this sort of thing before... I think I'm really close to getting it. I can view the menu in my browser while offline (locally), but i cannot figure out how to "embed" the menu on my webpage. Basically, I have a .swf and an .xml file. I then tried using the following html to insert it, but it doesn't work! HELP!!!



    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/
    cabs/flash/swflash.cab#version=6,0,29,0" width="width" height="height">
    <param name="movie" value="swf file path">
    <param name="quality" value="high">
    <param name="scale" value="noscale">
    <param name="bgcolor" value="background color">
    <param name="flashVars"
    value="xmlConfig=path to configuration file">
    <embed src="swf file path" width="width" height="height" flashvars="xmlConfig=path to configuration
    file" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shock
    wave-flash" scale="noscale" bgcolor="background color"></embed>
    </object>

  2. #2
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Well if the .swf works on your local machine but not when uploaded to your server, the problem is almost always a pathing issue. If you use something like this in your .swf:
    Code:
    var menu:XML = new XML();
    and
    Code:
    menu.load("scripts/menu.xml");
    Remember that the path to the swf and the xml are relative to the location of the html page which on which you did the "embedding", not simply the relationship used during creation. That means that during testing of the sample show above, the xml had to be placed in a folder called "scripts", which was at the same level as the html page. If the .swf was also placed in there, then the path from the html page to the swf would be:
    <param name="movie" value="scripts/menu.swf">
    Unless you put the correct path to the xml in while you were doing development (the extra folder depth), it may just read
    Code:
    menu.load("menu.xml");
    which would not load from an html page one folder level up. If the menu is duplicated in any subfolders, the relative address to the .swf and .xml will have to be changed to include the "../" up one level markup.
    One way to test correct pathing, type the file name directly into your browser address bar.
    www.mysite.com/scripts/menu.swf
    If you can't download direct, address is wrong, file does not exist, of file is in wrong place. this will also work for the .xml file.
    Best wishes,
    EfV

  3. #3
    Join Date
    Feb 2009
    Posts
    5
    I am a little unsure about the paths, so I just used the full path starting with http://. is this not going to work? i see now that i can change the background color, height, width. i now see a colored box of the specified dimensions, but i still cant get the swf object to appear. grrr.

    i am able to direct download the object by typing the path into my address bar. however, the object looks enlarged, blurry, fuzzy, etc. it does not appear as it does on my local drive.

  4. #4
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Absolute urls should work also, but you may get a security warning during testing from local machine, just follow the dialog box if it does.
    If you can download directly, great! It will appear larger because it has the whole browser to open in... for testing...not a problem. Can you also download the xml?
    As far as loading the .swf, the "embed" method is pretty much being phased out in favor of valid code. Here is one example:
    http://www.webdeveloper.com/forum/sh...ighlight=flash
    You can also use swfobject... a small .js file which is valid code and allows the use of alternate content for non Flash users.
    http://www.adobe.com/devnet/flashpla...object_02.html
    Here's an example of a swf menu with working alt content for non flash users... menu works fine either way. View the source code and notice how the menu buttons use alt content
    http://www.lostmountainsurfcompany.com/
    As for your example, the line that concerns me the most is the
    Code:
    flashvars="xmlConfig=path to configurationfile"
    Is this a menu template that you use xml to config and not actually read in the data or ????? Do you suspect any problems with that file?
    EfV

  5. #5
    Join Date
    Feb 2009
    Posts
    5
    ugggh. i can't figure this out for the life of me. none of the above examples contain a .xml file in addition to the .swf, so i'm still confused. any other suggestions?

  6. #6
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Typically loading the xml is handled inside the actionscript... but not always. In the example I was mentioning
    Code:
    var menu:XML = new XML();
    and
    Code:
    menu.load("menu.xml");
    The code is part of the actionscript and not the html. There is a bunch of code to create and fill an array that is placed between these two lines. Now your application may be completely different.
    What is the purpose of the xml file? Is it used to config a skin or something for the menu? Or does it provide the text that is used on the nav buttons of the menu?
    Do you have access to the Flash .fla file? Is there something like menu.load("menu.xml"); in the ActionScript?
    Without seeing the specifics.... I'm just guessing.
    EfV

  7. #7
    Join Date
    Feb 2009
    Posts
    5
    its become apparent that i need to have my hand held through this process.

    my xml file specifies the menu design as well as the navigation tree. is there any way i can email you the exact files i am dealing with? i would appreciate it tremendously, as i am about ready to give up.

  8. #8
    To clarify, is it that you can view the .swf file in the browser by going to www.yoursite.com/menu.swf but you cannot view it embedded on the page?

  9. #9
    Join Date
    Feb 2009
    Posts
    5
    well, i figured out how to embed it. now my problem is getting the pull down to overlap the html, rather than having a giant blank gap on my page. i understand this is a difficult problem to deal with. is it even possible? thanks!

  10. #10
    Hm, possibly using the wmode attribute:

    http://www.htmlforums.com/flash-deve...age-66350.html

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles