The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 10 of 10

Thread: reappearing/appearing div problem

  1. #1

    reappearing/appearing div problem

    ok first heres the javascript

    function MM_HideTheAd(){
    var theadvert;

    theadvert = document.getElementById('thead');
    theadvert.style.display = "none";
    }

    function MM_ShowTheAd(){
    var theadvert;

    theadvert = document.getElementById('thead');
    theadvert.style.display = "block";
    }

    and the html

    <body onload="MM_HideTheAd()">
    <div class="thead" id="thead">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="300">
    <param name="movie" value="flashadvert/smaller__non__continousrun.swf" />
    <param name="quality" value="high" />
    <embed src="flashadvert/smaller__non__continousrun.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="400" height="300"></embed>
    </object>
    </div>
    The flash movie is hidden at first but then at a certain point in the movie it calls the ShowTheAd function and appears....but only in IE, not in Firefox

    anyone any ideas why??????????????
    now with blog, click here

  2. #2
    icio's Avatar
    3,811
    posts
    looks better in lowercase
    I'm not sure that this would be the cause of it, but you shouldn't really have equal `class` and `id` attributes for the <div>

    Also, in your code - you would be better having:
    Code:
    document.getElementById('thead').style.display = "w/e";
    I seem to remember having a problem with differences in how the variables were handled in FF/IE, so maybe this might do some justice for it.
    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

  3. #3
    ok I tried adding the param

    <param name="allowScriptAccess" value="always" />

    but it doesn't seem to have an effect

    I changed this

    <div class="thead" id="thead">

    to this

    <div id="thead">

    my bad

    cyber bit confused, what value are you trying to pass to the display variable cause it's mostly just block or none but you got w/e....not sure what it is ot what it's trying to do but pasting it in the code it didn't work....

    anyone any ideas?
    now with blog, click here

  4. #4
    602
    posts
    Backend Specialist
    Maybe a little error trapping will do the job.

    1. Get rid of the div and see if FF will just show the flash object. if so, move on to 2, else look at your object statements
    2. get rid of the ShowAd in the onload function, just default the div to be open. If that works, try defaulting it to closed. Goto step 3 if no error yet.
    3. setup a button to run the showAd, default it to hide, then click the button to change it to show. if no error, goto 4.
    4. go through your functions and do some 'alerts()' on the variable youre using. Make sure it says [Object] or something. if you dont find anything there, goto 5.
    5. kill yourself.

    hth.

  5. #5
    ok this is driving me crazy, here is the javascript

    function hidemovie(){
    var thead;

    thead = document.getElementById('theflashad');
    thead.style.display = "none";
    alert("hidemovie");
    }
    function showmovie(){
    var thead;

    thead = document.getElementById('theflashad');
    thead.style.display = "block";
    alert("showmovie");
    }

    (notice new names for the functions, bit easier I feel)

    I removed all javascript calls from the flash file and the div and the movies play fine in FF and IE, but I need to hide the movies until a certain point (this is my version of a flash pop-up ad) so I added calls to the 2 functions above

    the flash movie calls both hidemovie(), not long after preloading, and then it calls showmovie() further down the line

    *** Using IE:
    The flash movie calls neither function and just runs without hiding or reappearing.

    *** Using Firefox:
    The flash movie calls hidemovie(), the javascript function then hides the div but then nothing else happens. There is a call to the showmovie but it just seems to ignore it

    here is the flash object tag
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" id="runmovie" height="300"><param name="allowScriptAccess" value="always" /><param name="movie" value="flashadvert/runman_one.swf" /><param name="quality" value="high" /><embed src="flashadvert/runman_one.swf" name="runmovie" swLiveConnect="true" allowScriptAccess="always" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="400" height="300"></embed></object>
    I'm calling the javascript functions by simply placing

    getURL("JavaScript:showmovie()");

    in the code

    help :(
    Last edited by RabBell; November 18th, 2005 at 10:33 AM.
    now with blog, click here

  6. #6
    added the fla if that helps anyone

    please help make a sane man sane again
    Attached Files Attached Files
    now with blog, click here

  7. #7
    icio's Avatar
    3,811
    posts
    looks better in lowercase
    OK, I was trying some stuff out - you can see my result in the attached file.

    You'll noticed, as an attribute in the <embed> tag, there is: `swliveconnect="true"`. That's what my search came up with and it seemed to make a difference.

    The only thing is the security warning you get when you try - I doubt that you would be able to get rid of this, otherwise what would be the point in the security?

    Hope this helps
    Attached Files Attached Files
    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

  8. #8
    great thanks icio

    it works fine in IE, but not firefox...still got the problem where it disappears and then doesn't come back

    I changed your code a bit so that the 2 javacript functions are being called by the flash movie and it works fine in IE, just not in Firefox

    also cyber I couldn't open your flash (I'm using Flash MX 2004)
    Attached Files Attached Files
    Last edited by RabBell; November 18th, 2005 at 03:14 PM.
    now with blog, click here

  9. #9
    icio's Avatar
    3,811
    posts
    looks better in lowercase
    Here's the code that I had on the timeline. Nothing complicated.
    Code:
    /* These functions call the javascript.
    ********************************************* */
    function showFlash() {
    	getURL("javascript: showFlash();", "_self");
    }
    function hideFlash() {
    	getURL("javascript: hideFlash();", "_self");
    }
    
    /* For the buttons.
    ********************************************* */
    _root.hide_btn.onRelease = function() {
    	hideFlash();
    }
    _root.show_btn.onRelease = function() {
    	showFlash();
    }
    The show and hide js script in index.html worked for me in firefox and in opera.
    I've noticed that IE doesn't bring up the same security dialog box as ff and opera do, though. I don't know much about the newer flash players' security settings, but there should be some on the macromedia site, somewhere. I pretty certain this is where the problem is.

    In fact, I found this: http://www.macromedia.com/cfusion/kn...fm?id=tn_15683
    which answers all of your questions, so I was almost there - you just need to use `fscommand` to call the javascript function instead of the `getURL`.

    off topic:
    -------------------------

    Ahha, "cyber". Those were the days (cyber is not a verb here, btw.)

    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

  10. #10
    ok, update

    I tried using fsCommand and getURL but it still wasn't working in firefox, so I added some javascript functions to hide and show the movie and thats when I realised the problem....

    In IE, the flash movie called the javascript function, hidemovie, and the movie is hidden. While it's hidden the movie keeps playing and hits the part of the flash movie when the showmovie function is called and viola, the movie reappears...fine no problems there

    In Firefox, the flash movie called the javascript function, hidemovie, and the movie is hidden. BUT when the movie is hidden, the movie stops.......thats why the functions not called, because the movie has stopped

    It keeps playing in IE while hidden but in Firefox, it stops

    EUREKA!!!!!!

    Anyone any ideas on how to fix this?
    now with blog, click here

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012