Javascript Call from AS3 Playbar

Platform: Captivate 7
Source: AS3 (hopefully obvious!)
Output: Flash v10
I'm making a one-off version of one of the default playbars.  I am trying to make the Exit button call a JavaScript function using the following code:
var btnTipsId = 8;
function onClicked()
          import flash.external.ExternalInterface; //Register ExternalInterface
          ExternalInterface.call("closeModule()"); //Call JS to close Div
//parent.onPBCBtnClick("exit");
As you can probably see, I don't want to Exit button to close the module the way it normally does.  My "closeModule()" function removes a a Div layer that hosts the Captivate.  I know this works as we use it in other places.  The problem I'm encountering is strictly with getting the Playbar to call that JavaScript instead of it's default "parent.onPBCBtnClick("exit");" function.
Any ideas?

Okay, it turns out my original code was totally right with one significant exception.
What was it?
Wait for it ...
Wait for it ...
I was calling the wrong JS function.
<forehead slap>

Similar Messages

  • Javascript calls from flash send GET request

    I'm having this problem with calling a javascript function
    after opening a new URL from flash. Basically what I have going on
    in my flash is a button, that when clicked, opens a new URL in
    "_blank" sending values to it using a POST request (I have done
    this both by using getURL and by using a LoadVars object). This
    part works fine, however immediately after it, I have a call to the
    javascript function "window.close()" (which I have done both using
    getURL and ExternalInterface). This works great in Firefox, but in
    IE the POST request seems to be getting interrupted by the
    javascript call.
    I did a check on the values getting passed using Charles, and
    it clearly shows that in IE there is a POST request getting sent to
    the page I'm loading in the new window, immediately followed by a
    GET request. This get request overrides the POST and for some
    reason only appears when making a javascript called. If I change
    that javascript call to opening a new URL in _self, for example, it
    doesn't show up.
    Does anyone have any idea what this is all about? Is there a
    solution to this? Why is this happening?!

    Thanks for the speedy reply!
    I'll just have to double check to make sure that any of the AJAX calls are security checked.

  • Download File Via JavaScript Calls From Website

    Hello,
    I am currently trying to create a program in c# that will download the file "PracticeProfiles.xls" from this website:
    http://fingertips.phe.org.uk/profile/general-practice/data
    I need to somehow on navigation to this site pass the javascript calls "showExport();exportData();", which will start the download.
    Any help would be greatly appreciated.
    Many Thanks

    The link has a method which apparently works, however I had to modify a few things to make it compile:
    public void DownloadIEFile(Browser browser)
    HwndSource source;
    source = HwndSource.FromHwnd(WatiN.Core.Native.Windows.NativeMethods.GetWindow(browser.hWnd, 5));
    Window windowMain = source.RootVisual as Window;
    System.Windows.Automation.TreeWalker trw = new System.Windows.Automation.TreeWalker(System.Windows.Automation.Condition.TrueCondition);
    System.Windows.Automation.AutomationElement mainWindow = trw.GetParent(System.Windows.Automation.AutomationElement.FromHandle(browser.hWnd));
    source = HwndSource.FromHwnd(WatiN.Core.Native.Windows.NativeMethods.GetWindow(new WindowInteropHelper(windowMain).Handle, 5));
    Window windowDialog = source.RootVisual as Window;
    // if doesn't work try to increase sleep interval or write your own waitUntill method
    Thread.Sleep(1000);
    windowDialog.Activate();
    System.Windows.Automation.AutomationElementCollection amc = System.Windows.Automation.AutomationElement.FromHandle(new WindowInteropHelper(windowDialog).Handle).FindAll(System.Windows.Automation.TreeScope.Children, System.Windows.Automation.Condition.TrueCondition);
    foreach (System.Windows.Automation.AutomationElement element in amc)
    // You can use "Save ", "Open", ''Cancel', or "Close" to find necessary button Or write your own enum
    if (element.Current.Name.Equals("Save"))
    // if doesn't work try to increase sleep interval or write your own waitUntil method
    // WaitUntilButtonExsist(element,100);
    Thread.Sleep(1000);
    System.Windows.Automation.AutomationPattern[] pats = element.GetSupportedPatterns();
    // replace this foreach if you need 'Save as' with code bellow
    foreach (System.Windows.Automation.AutomationPattern pat in pats)
    // '10000' button click event id
    if (pat.Id == 10000)
    System.Windows.Automation.InvokePattern click = (System.Windows.Automation.InvokePattern)element.GetCurrentPattern(pat);
    click.Invoke();
    However I am getting null when I try to get the hwnd source, can't see why?
    Any Suggestions?
    Many Thanks

  • Can I Capture Javascript Calls from a Loaded SWF?

    My scenario:
    My main movie (SWF A) loads another movie (SWF B) and plays it.
    SWF B is legacy content - I can't modify it.
    SWF A is AS3. SWF B might be AS2 or AS3
    SWF B makes several calls to a javascript function that would normally reside in the hosting web page.
    The javascript calls might use ExternalInterface, or they might use getURL(javascript: xxx) or they might even use fscommand.
    My questions:
    Is there any way I can intercept the javascript call in movie A? I don't want to have to resort to the browser, so simply using ExternalInterface or similar to pipe the request back into the movie won't work.
    If there is a way, how does it vary across the different versions (ie. what's the difference between the child movie being AS2 or AS3, and what's the difference between the various means of calling js?
    I'm working on a web deployment, using Flex 4.0. I would be interested also in whether this is possible in Air, or Air Mobile.
    Many thanks in advance for any replies.
    JcFx
    http://www.jcfx.eu

    no, not with all those constraints.

  • Javascript call from Flash in modal dialog window

    Hi.
    As I see it's impossible to call Javascript function from
    flash in modal dialog (opened with showModalDialog), neither with
    getURL nor with ExternalInterface.call.
    The only solution I found (in my case it's enough, I only
    need to refresh some DIV content in the page from flash) is to
    catch error in the modal dialog (Javascript window.onerror) and
    then do some operations.
    I'm intereseted: is this for security reason on Win XP SP2? I
    didn't found any solution, but is there any?

    Hi Gary,
    Actually I'm not very sure that whether it is the VS issue if it still has this issue in a new Environment.
    To make sure that it is not the VS setup file issue, one idea is that you could re-download your VS2013 Pre version here:
    http://www.visualstudio.com/downloads/download-visual-studio-vs
    And then re-install it again. Test the result. Hope that it is not the VS setup file issue.
    If still no help, really sorry for that I couldn't repro this issue in my side. But
    you can submit this feedback to Microsoft Connect feedback portal:
    http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx,Microsoft
    engineers will evaluate them seriously. You could share this project in your report, the product team members would troubleshoot and repro this issue.
    You will get email notification for update in your connect report.
    If you submit it, please share us the link here, so we could get the latest information from the product team members.
    Sincerely,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Javascript called from actionscript not working properly

    I have a flash file that I want to change the background of
    an HTML frame when Scene2 begins. The code I have works fine in
    Safari and gives the desired result. However, calling it from
    firefox own Win IE, results in the javascript being placed in the
    address bar, and the name of the bkg image placed in the upper left
    corner.
    Here is the code in the flash file...
    getURL("javascript
    ocument.body.background='fork.jpg'");
    Here is the URL to the site
    http://www.nealstudio.com/ametricstest/flashtest.html
    Surely, it's something simple that I'm missing.

    MacManSC wrote:
    > I changed the code to make it work. Previously, I had no
    javascript in the HTML
    > document. I went in and changed the js in the flash to
    just a call for the code
    > in the HTML. It was my understanding that with my
    original code, that I didn't
    > need to have any further js.
    >
    yes that's quite correct although you'll find it's much more
    robust to
    put all your javascript into functions, which should be
    stored in an
    external .js file. That way, if you need to change anything
    you mostly
    won't need to go into flash at all, just edit the function in
    the .js
    file. Having the external .js then allow you to include the
    same
    functionality on different pages in your site whilst keeping
    all
    functions in one place.
    MOLOKO
    Macromedia Certified Flash MX 2004 Developer
    Macromedia Certified Flash MX Developer
    ::remove _underwear_ to reply::
    'There ain't no devil - it's just God when he's drunk' Tom
    Waits
    GCM/CS/IT/MC d-- S++:- a- C++ U--- P+ L++ !E W+++$ N++ O? K+
    w+++$ !O M+
    VMS? PS+++ PE- Y PGP+ t+ 5-- X-- R* tv++ b++++ DI++++ D+ G e
    h-- r+ y++

  • SetCookie Javascript call from applet pops up the launcher browser window

    Hi,
    With Jre 1.5 we started seeing a strange problem.
    From our applet code at the end of loading the applet we call a setcookie on our parent browser window (Browser window used to access our html/applet page).
    Once we make this call the browser window comes on top of our applet window.
    This was working fine earlier, with jre 1.5 we started seeing this issue. Any thoughts?
    A workaround is to call the toFront() function on the applet window's mainframe and set it in the front again. I was wondering if any one have seen similar problem.
    It happens only with IE on windows, no issue on netscape/mozilla.
    Thanks
    RT

    this is now resolved. My call to the transaction was slightly incorrect. This is now the working code:
    CONCATENATE 'http'
    '://' host ':' port
    '/sap/bc/gui/sap/its/webgui/?~transaction=*MIR4 RBKP-BELNR=5105600751' ';DYNP_OKCODE=SHOW'
    into url.

  • Javascript call from a Flash button

    I have 2 Panel Groups of 5 panels each and I made a Flash
    button to controll them.
    The following code works if the panels are both open but it
    only works the first time.
    Then the second time I get an error;
    cpg is undefined
    CODE:
    on(release){
    getURL("javascript:cpg.closeAllPanels();cpg2.closeAllPanels()");
    This would need to work for both panelgroups even if only one
    is open.
    I tried using fscommand but not sure how to write it.

    Hi Doug,
    A few questions for you...
    <ol>
    <li>What functionality are you trying to achieve?</li>
    <li>What version of APEX are you using?</li>
    <li>When you say 'process', do you mean 'Page Process'?</li>
    </ol>
    There are definitely ways of submitting the page and triggering a page process to run via JavaScript, but it would be good to better understand your requirements first before proposing a certain solution.
    Regards,
    Anthony.

  • After update to Firefox 15 it crashes after javascript call window.close();opener.alert('test');. Is this working as intended or is it a bug?

    After update to Firefox 15 it crashes after javascript call from a popup window.close();opener.alert('test');. Is this working as intended or is it a bug?

    According to the pages linked to the crash ID, there is a bug report on this.
    Does the crash occur as soon as you run those two lines of code, or after dismissing the alert()?
    If this is your application, why are you running script commands after calling window.close()? Could you avoid the problem by using an approach like this:
    <br>window.setTimeout(function(){opener.alert('test'},250);
    window.close();

  • How can fill javascript array from list in jsf backing bean

    Hello
    i have an array in javascript and i want to fill in from the list which is coming from the backing bean how can i do that.
    Regards

    Hi,
    using the ExtendedRenderkitService class you can send JavaScript calls from a managed bean to the client. So in your case you call a client side javaScript method and pass the array information as an argument. The way you pass the array data is up to you. You may just pass a character delimited list, or use JSON object notation in case the list shows objects. Note that this is for JDeveloper 11.In 10.1.3 there is no server side JavaScript API. Here you would have to add the JavaScript to the page when rendering it.
    Frank

  • Passing html from AS3 to Javascript

    I am using WebStageView to pass html from AS3 to a Javascript function in a webpage.
    I do this like:
    var urltext:String = "javascript:setText('aaa','vvv')"
    webView.loadURL(urltext);
    This successfully calls a function in JS named setText  which in turn sets the value of a div  or whatever else I want to do.
    Here is the problem:
    If I want to pass:
    var urltext:String = "javascript:setText('<p>aaa</p>','vvv')"    the formatted text works fine and I get no errors  however,
    if I pass it like this:  
    var txt:String = '<p>aaa</p>';
    var urltext:String = ""javascript:setText('+txt+','vvv')"       then I get a parse error;
    It traces out to look like this:
    urltext: javascript:setText('<p>aaaaa</p>
    ','vvv')
    Notice that there is a return after the   </p>     which is apparently causing the parse error.
    I am loading text from a file and passing it via the above call to JS.
    In short, is there a way to format the text so it doies not cause the parse error?
    Or, is there a better way to pass html strings in a call to Javascript?
    ExternalInterface does not seem to work anymore  and I am avoiding WebStageViewBridge.

    Ain't that the way of it..
    Came up with a solution Minutes after I posted this problem.
    Here it is, just in case:
    var urltext:String = "javascript:setText("+com.adobe.serialization.json.JSON.encode(fileText)+",'vvv')"

  • How to call a Javascript function from backing bean without any event

    Hi,
    Someone knows how to call a Javascript function from backing bean without any event ?
    thanks

    Please review the following thread:
    ADF Faces call javascript
    Luis.

  • Applet with JFilechooser called from a Javascript blocks paint messages

    Hi,
    I am trying to create an applet that can:
    1) be called from a Javascript
    2) displays a file selection dialog for multi-selecting files
    3) returns the selected filenames in a string to the JavaScript
    I am able to use doPrivileged to apply the necessary security context to launch a JFilechooser and return the filenames selected. However, When the JFilechooser dialog is visible and the user moves the dialog window around the HTML pages dose not receive any repaint messages. They seem to be blocked by the thread that launched the JFilechooser dialog and is probably blocking update events as the dialog is still visible.
    I know I need some type of a message pump so the child thread can inform the parent thread and the browser to repaint. However, I don't know how to do this.
    Please help.
    ------Applet Code Begin:-----
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.AWTEvent;
    import java.awt.event.AWTEventListener.*;
    import java.awt.event.MouseMotionListener;
    import java.awt.event.MouseEvent;
    import java.io.File;
    import java.util.Locale;
    import java.util.MissingResourceException;
    import java.util.Properties;
    import java.util.ResourceBundle;
    import java.util.Vector;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class SampleApplet extends JApplet
       boolean allowDirs=false;
       boolean allowFiles=true;
       boolean hidden=false;
       File lastUserDir=null;
       public void init()
        public void start()
        public void stop()
        public String selectFiles()
           String choosenFiles = null;
           choosenFiles = new String((String)java.security.AccessController.doPrivileged(
           new java.security.PrivilegedAction()
         public Object run()
            String choosenFiles=new String();
                 JFilechooser fc = new JFilechooser();
         fc.setFileSelectionMode(allowDirs ? (allowFiles ? JFileChooser.FILES_AND_DIRECTORIES
            : JFileChooser.DIRECTORIES_ONLY)
            : JFileChooser.FILES_ONLY);
         fc.setMultiSelectionEnabled(true);
                 int returnVal = fc.showOpenDialog(null);
                 if (returnVal == JFileChooser.APPROVE_OPTION)
                    choosenFiles = "The selected filesnames will be stuffed here";
              return choosenFiles; //return whatever you want
           return choosenFiles;   
    ------Applet Code End:-----
    ------Html Code Begin:-----
    <html>
    <applet id="SampleApplet" archive="SampleApplet.jar"; code="SampleApplet.class"; width="2" height="2" codebase=".">
    </applet>
    <head>
        <title>Untitled Page</title>
    <script language="javascript" type="text/javascript">
    function SelectFiles_onclick()
      var s = (document.applets[0].selectFiles());
      alert(s);
    </script>
    </head>
    <body>
        Click Test button to select files
        <input id="SelectFiles" type="button" value="Select Files" onclick="return SelectFiles_onclick()" />
    </body>
    </html>
    ------Html Code End:-----

    try this:
    first don't open the file dialog in the SelectFiles call. Start a new thread that does that. Then return from the SelectFiles call immediately. Now after the user selectes the files call back into the javascript by doing something like this:
    pass the list of files into this function, each on being a String in the params array
        public synchronized void sendDataToUI(Object[] params) {
            if (FuserState.hasQuit()) {
                return;
            String function = "getUpdates";
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "Calling Javascript function " + function);
            if (getJavaScriptWindow() == null) {
                logger.log(Level.SEVERE, "Member javascriptWindow is NULL, no call was made!");
                return;
            try {
                getJavaScriptWindow().call(function, params);
            catch (netscape.javascript.JSException x) {
                if (params == null) {
                    logger.log(Level.SEVERE, "p=NULL PARAM");
                } else {
                    logger.log(Level.SEVERE, "p=" + params[0]);
        protected JSObject getJavaScriptWindow() {
            javascriptWindow = JSObject.getWindow(this);
        }

  • Help needed in calling a javascript function from a jsp

    Hey guys,
    I need help.
    In my jsp I have a field called date. When i get date field from the database, it is a concatination of date and time field, so I wrote a small javascript function to strip just the date part from this date and time value.
    The javascript function is
    function formatDate(fieldName)
              var timer=fieldName;
              timer = timer.substring(5,7)+"/"+timer.substring(8,10)+"/"+timer.substring(0,4);
              return timer;
    Now I want to call this javascript function from the input tag in jsp where I am displaying the value of date. Check below
    This is one way I tried to do:
    <input size="13" name="startDate" maxLength="255" value=<script>formatDate("<%=startDate%>")</script> onChange="checkDate(this)">
    I even tried this:
    <input size="13" name="startDate" maxLength="255" value="'formatDate(<%=startDate%>)'" onChange="checkDate(this)">
    But it dosen't work
    Please help. I am struggling on this for days.
    Thanks,
    Ruby

    Hey all you developers out there , Pleaseeee help me with this one.

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

Maybe you are looking for

  • Get Full name from Get-MailBoxPermission

    I am trying to build a report with the names of users who have access to shared mailboxes. I have the command running and outputting good information, but it displays a table in the following format: User Domain\Username How can I get output that dis

  • Authentication failed, ADFFacesContext had not been properly released

    hi, I setup Login page through ADF security wizard in jdev 10.1.3.2 and set error page to be the same Login page. The rest of login process is same as in SRDemo: index page redirects to Welcome page, user press Start button etc. But if the user enter

  • FRM-40509: ORACLE error: unable to UPDATE record.

    FRM-40509: ORACLE error: unable to UPDATE record. what can i do?

  • Color shift from Photoshop to InDesign?

    I'm using Adobe's Creative Cloud family of apps, which have been color synchronized with Adobe Bridge using the North American General Purpose 2 color setting. All of the files I'm working with are set to CMYK. My Photoshop files are set to 8 bits/ch

  • HOW DO I MAKE IMAGES DYNAMIC USING DREAMWEAVER & MySql

    Hi there,    I wanted to make images dynamic in that the images would be stored in my database and then use dreamweaver to pull the images from the database using a recordset. But how do I get to store the images in MySql now that dreamweaver doesn't