A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Using javascript to make flash/div disappear?

  1. #1
    Junior Member
    Join Date
    Nov 2007
    Posts
    7

    Unhappy Using javascript to make flash/div disappear?

    Hi,

    I'm trying to get my swf to call a js function that will move my div out of view.

    To get it to stay at the bottom I'm using fixed positioning.

    I'm having problems with a couple of things:

    1. The javascript code to change the div style from fixed to absolute and then move it -1000

    2.Getting the red background to cover the entire width of the screen but keep the main part of the swf to stay the same size.

    I've attached my .fla and you can see what I have already at http://test.justsandymedia.com/worki...01_10v5_2.html

    MY .FLA

  2. #2
    Junior Member
    Join Date
    Nov 2007
    Posts
    7

    Reworded - Problem with calling a Javascript function from flash

    I've reword my question as belows as it might make more sense.

    I'm using this to call the function from flash:

    Code:
    ExternalInterface.call("pgcover");
    I know that this is calling the function as I have set it trigger an alert action and this comes up properly.

    But I don't want the function to trigger an alert, this is just for testing purposes.

    I instead want it to change the styling on a div.

    I have set up a test page where I have asigned the function to a button and this works, the div display changes from block to none.

    When I get the swf to call the function setup to do the same thing, nothing happens.

    Code:
    function pgcover() 
    { 
      document.getElementById("unlayout").style.display= "none";
    }
    My swf is embedded in the html page that the javascript is on, I have checked all code and have rulled out spelling mistakes etc.

    Any help with this would be amazing as it is driving me crazy.

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    My best guess is that because you're loading the Flash file from a different domain, Flash's security isn't allowing you to call the Javascript functions. Try adding a allowScriptAccess parameter to your embed code:

    http://kb2.adobe.com/cps/164/tn_16494.html

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