Not signed in (Sign In)

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

    • CommentAuthorpet-theory
    • CommentTimeDec 29th 2006
     
    Hi,

    I've just started with SWFObject. Basically I need it to use SWFAddress, to deeplink with url queries.

    Getting a page up and running has been no problem, but testing/tracing is. How can I get the debugger in Flex Builder to listen to a debug swf embedded in html using SWFObject, rather than its own Flex Builder generated page?

    This is not a SWFObject question per se. So I apologize if I'm diluting your focus. But maybe this will be a common problem?

    Thanks in advance,

    matt
    • CommentAuthorpet-theory
    • CommentTimeDec 29th 2006
     
    The "solution":

    I copied the html wrapper that Flex Builder creates for you.

    I point the compiler towards it (Project-->Debug As-->Debug-->untick Defaults-->point debug towards copied file).

    I added this line:

    <script type="text/javascript" src="swfobject.js"></script>

    I replaced this line:

    <iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>

    with these lines:

    <div id="flashcontent">

    This text is replaced by the Flash movie.
    </div>
    <script type="text/javascript">
    var so = new SWFObject("Shell.swf", "Shell", "800", "600", "9", "#999999");
    so.addVariable("indices", getQueryParamValue("indices"));
    so.write("flashcontent");
    </script>

    and I deleted these lines:

    <noscript>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    id="Shell" width="100%" height="100%"
    codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
    <param name="movie" value="Shell-debug.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#869ca7" />
    <param name="allowScriptAccess" value="sameDomain" />
    <embed src="Shell-debug.swf" quality="high" bgcolor="#869ca7"
    width="100%" height="100%" name="Shell" align="middle"
    play="true"
    loop="false"
    quality="high"
    allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash"
    pluginspage="http://www.adobe.com/go/getflashplayer">
    </embed>
    </object>
    </noscript>

    Since I don't know html well, these were just nearly blind guesses.

    The result: the html showed errors, but the debug file compiled and launched.

    Still haven't got Flash vars to work, but that's another problem.
    • CommentAuthorpet-theory
    • CommentTimeDec 29th 2006
     
    No indication that SWFObject is working, I think because of all the javascript errors:

    Severity and Description Path Resource Location Creation Time Id
    Fatal error - The string "--" is not permitted within comments. Pet_Theory/bin Shell-debug_SO_insert.html line 13 1167440547157 33676
    Fatal error - The string "--" is not permitted within comments. Pet_Theory/bin Shell-debug.html line 12 1167437451066 33590
    Fatal error - Open quote is expected for attribute "id" associated with an element type "object". Pet_Theory/bin history.htm line 11 1167438526923 33601
    Error - The content of element type "head" is incomplete, it must match "((script|style|meta|link|object|isindex)*,((title,(script|style|meta|link|object|isindex)*,(base,(script|style|meta|link|object|isindex)*)?)|(base,(script|style|meta|link|object|isindex)*,(title,(script|style|meta|link|object|isindex)*))))". Pet_Theory/bin history.htm line 8 1167438526922 33600
    Error - Attribute "type" is required and must be specified for element type "style". Pet_Theory/bin Shell-debug_SO_insert.html line 8 1167440547157 33675
    Error - Attribute "type" is required and must be specified for element type "style". Pet_Theory/bin Shell-debug.html line 7 1167437451066 33589
    Error - Attribute "type" is required and must be specified for element type "script". Pet_Theory/bin Shell-debug_SO_insert.html line 6 1167440547156 33674
    Error - Attribute "type" is required and must be specified for element type "script". Pet_Theory/bin Shell-debug.html line 6 1167437451014 33588

    Hmm, knowing even less Javascript than HTML, I'm totally winging it, and it didn't work. Here's the original page. minus the commented out player-detection part:

    <!-- saved from url=(0014)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="AC_OETags.js" language="javascript"></script>
    <style>
    body { margin: 0px; overflow:hidden }
    </style>
    <noscript>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    id="Shell" width="100%" height="100%"
    codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
    <param name="movie" value="Shell-debug.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#869ca7" />
    <param name="allowScriptAccess" value="sameDomain" />
    <embed src="Shell-debug.swf" quality="high" bgcolor="#869ca7"
    width="100%" height="100%" name="Shell" align="middle"
    play="true"
    loop="false"
    quality="high"
    allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash"
    pluginspage="http://www.adobe.com/go/getflashplayer">
    </embed>
    </object>
    </noscript>
    <iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>
    </body>
    </html>

    How would you embed SWF in this page? I'd love to know.
    • CommentAuthorpet-theory
    • CommentTimeDec 29th 2006
     
    Actually, the errors are erroneous--I had my html open in my XMLBuddy plugin! Duh. When I open the file in Dreamweaver, no errors.

    So the SWFObject just doesn't work. Here's how I'm testing it:

    in the html page:

    <script type="text/javascript">
    var so = new SWFObject("Shell.swf", "Shell", "800", "600", "9", "#999999");
    so.addVariable("hello", "world");
    so.write("flashcontent");
    </script>

    and in my main/app class, I declare the var:

    var hello:String

    and after a suitable delay (a couple things load)...

    trace (hello);

    I get null.
    • CommentAuthorGeoff
    • CommentTimeJan 2nd 2007
     
    you need to provide a div to place the swf into... like in your first example:

    <div id="flashcontent">

    This text is replaced by the Flash movie.
    </div>
    <script type="text/javascript">
    var so = new SWFObject("Shell.swf", "Shell", "800", "600", "9", "#999999");
    so.addVariable("indices", getQueryParamValue("indices"));
    so.write("flashcontent");
    </script>

    I'm not sure how flex handles tracing in the browser, though... are there other elements on the page that the swf needs to talk to in order to handle the traces?