Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthormtrak
    • CommentTimeJan 30th 2008 edited
     
    Hi,
    This is what I'm using currently that works:
    <embed src="http://www.xyz.com/player/embed/" width="270" height="223" type="application/x-shockwave-flash"
    FlashVars="CONFIG_URL=http://www.xyz.com/player/embed/configuration.jhtml%3fid%3D26237" base="." />

    So nowhere is there actually a path to the flash file itself, but it's passing some parameters via FlashVars like so.

    I tried:
    var so = new SWFObject("http://www.xyz.com/player/embed", "this_is_the_id", "270", "233", "9", "");
    so.addVariable("CONFIG_URL", "<%= flash_url2 %>"); //flash_url2=http://www.xyz.com/player/embed/configuration.jhtml%3fid%3D" + id
    (or)
    so.addParam("FlashVars","CONFIG_URL=http://www.wyz.../etc");

    Didn't work..

    If I put http://www.xyz.com/player/embed directly into brower, it redirects to http://www.xyz.com/global/apps/fbml/xyzi/flash_browser_fp8.swf

    So I put that in, but still doesn't work.

    Is this because the I don't have a static path to the .swf file and it's being generated somehow via this jhtml page?

    Anyone recognize this issue? Thanks
    • CommentAuthorphilip
    • CommentTimeJan 30th 2008
     
    i've never tried *not* using the filename.

    just out of curiosity, why don't you want to use the full URL?
    • CommentAuthorAran
    • CommentTimeJan 30th 2008
     
    so.addVariable("CONFIG_URL", "<%= flash_url2 %>"); is the proper way to do it. If you view the rendered source of the page, or do a js alert of the var value, is it giving you back the location you are expecting?

    There is no so.addParam("FlashVars"," type functionality in swfObject 1.x, so don't try to pursue that direction.

    In terms of your swf location, as long as http://www.xyz.com/player/embed is redirecting to an actual .swf file, then it should be all good. I have used dynamic server locations for swf before without issue.

    Post a page up and I can see what the page is actually doing.

    Cheers,
    Aran
    • CommentAuthormtrak
    • CommentTimeJan 30th 2008
     
    The videos are hosted offsite and we're putting it onto ours. So we're not hosting them and have no control how it's served, just have to follow the format they use.

    So this is the code I use to embed one of their videos and this works.

    <embed src="http://www.mtvu.com/player/embed/" width="270" height="223" type="application/x-shockwave-flash" FlashVars="CONFIG_URL=http://www.mtvu.com/player/embed/configuration.jhtml%3fid%3D1573117%26vid%3D185452&allowFullScreen=true" allowFullScreen="true" AllowScriptAccess="never" base="." />

    Aran, everything I have is local right now, so I'm not sure what I can show you. Here's a link to one of the videos: http://www.mtvu.com/video/?id=1510652

    So what I'm doing is just passing the same parameters they have on theirs, which is is http://www.mtvu.com/player/embed along with the CONFIG_URL param.

    This is confusing me.

    I guess the question is.. say you have a page for example www.blah.com/thevid/index.aspx?id=123 and that page sends back the flash vid dynamically. So can you put www.blah.com/thevid/as your url, then have so.addVariable("id", "123")?
    • CommentAuthorAran
    • CommentTimeJan 30th 2008
     
    Ok.

    So the below works for me (which is the exact equivalent as your embed code except I don;t know what version or color you want):

    <script type="text/javascript">
    var so = new SWFObject("http://www.mtvu.com/player/embed/", "mtvu", "270", "223", "8", "#336699");
    so.addVariable("CONFIG_URL", "http://www.mtvu.com/player/embed/configuration.jhtml%3fid%3D1573117%26vid%3D185452");
    so.addVariable("allowFullScreen", "true");
    so.addParam("allowFullScreen", "true");
    so.addParam("AllowScriptAccess", "never");
    so.addParam("base", ".");
    so.write("flashcontent");
    </script>


    You can see it working here:
    http://www.misterhee.com/tests/mtvu.html

    Does this answer all of your questions, or are you still confused about how to pass variables?

    with your id=123 example, if that whole string redirects to an actual FLV / swf, then you can just pass in the whole string like the CONFIG_URL value. You could make a js wrapper function which just changed the id based on a param if that was useful to you. Like:

    function changeVid (id)
    {
    var so = new SWFObject("http://www.mtvu.com/player/embed/", "mtvu", "270", "223", "8", "#336699");
    so.addVariable("CONFIG_URL", "http://www.mtvu.com/player/embed/configuration.jhtml?id=" + id);
    so.addVariable("allowFullScreen", "true");
    so.addParam("allowFullScreen", "true");
    so.addParam("AllowScriptAccess", "never");
    so.addParam("base", ".");
    so.write("flashcontent");
    }

    // notice I am constructing the CONFIG_URL with the combo of a static string and a js var. You could statically or dynamically construct the string as you liked (the ?id=... is just an illustration)

    This js var might be a ASP var instead like you had in your first post in which case you could do :

    so.addVariable("CONFIG_URL", <%= flash_url2 %>);

    - I think you might need to remove the quotes from the ASP var from your first post to get it to work properly

    Aran
    • CommentAuthormtrak
    • CommentTimeJan 31st 2008
     
    Aran, Thanks a lot, but as I was playing around with yours, I realized what I did wrong.. I placed the javascript BEFORE the div. I thought you could put the javascript in the head portion, but I guess you must have it after the div?

    Well, regardless it works now.

    Thanks for working it out on your end.
    • CommentAuthorphilip
    • CommentTimeJan 31st 2008
     
    you can put the JS in the head if you like, but it has to be processed AFTER the page elements are rendered, which means a window.onload event. if you keep the JS in the body of the document, it can only be invoked after the target element has been written.

    for instance:

    JS stored in body of document (WON'T WORK... "flashcontent" div doesn't exist yet)

    <script type="text/javascript">
    var so = new SWFObject("myswf.swf", "exmaple", "550", "400", "8", "#FFFFFF");
    so.write("flashcontent");
    </script>

    <div id="flashcontent"></div>


    JS stored in body of document (WORKS)

    <div id="flashcontent"></div>

    <script type="text/javascript">
    var so = new SWFObject("myswf.swf", "exmaple", "550", "400", "8", "#FFFFFF");
    so.write("flashcontent");
    </script>


    JS stored in head of document (WON'T WORK... "flashcontent" div doesn't exist yet)

    <head>
    <script type="text/javascript">
    var so = new SWFObject("myswf.swf", "exmaple", "550", "400", "8", "#FFFFFF");
    so.write("flashcontent");
    </script>
    </head>
    <body>
    <div id="flashcontent"></div>
    </body>


    JS stored in head of document (WORKS)

    <head>
    <script type="text/javascript">
    window.onload = function (){
    var so = new SWFObject("myswf.swf", "exmaple", "550", "400", "8", "#FFFFFF");
    so.write("flashcontent");
    }
    </script>
    </head>
    <body>
    <div id="flashcontent"></div>
    </body>


    - philip
    • CommentAuthormtrak
    • CommentTimeJan 31st 2008
     
    Gooot it. I wasn't putting 2 and 2 together.. I see now that the div id wasn't defined yet and it's working in a linear order.

    Thanks for pointing that out.
    • CommentAuthormtrak
    • CommentTimeJan 31st 2008
     
    Aran just out of curiosity are you a designer?
    • CommentAuthormtrak
    • CommentTimeJan 31st 2008 edited
     
    Now it's not working in Firefox! Aran, that sample you did for me, it worked when I last checked in FF, but just checked again and it doesn't.. it's displaying the text inside the div.

    What gives?

    *EDIT* Nevermind, just realized when you run uninstall program it also uninstalls from Firefox, so I just had to reinstall in FF again.
    • CommentAuthorAran
    • CommentTimeJan 31st 2008
     
    @mtrak - Am I a designer?

    I am much more of a flash developer than a designer.

    There are many people better than me at making things look pretty (although I do design work on private client work). I'm more down with the actionscript side of things, as I have been working full-time with flash for almost 10 years (wow - now I'm kinda sounding old huh?)

    I work full-time as System Architect / solutions manager for a software company based in Australia.
    • CommentAuthormtrak
    • CommentTimeJan 31st 2008
     
    Cool, I saw your front page of that site and thought it looked cool, that's why I asked. It's cool man 10 years ago I was making really lame flash pages with techno music in the background, and I haven't improved much since