Calling Javascript from Flex through FAB

What's the standard way of calling JavaScript functions from
Flex through the FA Bridge?
i.e. is there a new way other than navigateToURL or
ExternalInterface.call()
Most of the examples I've seen are scripting Flex from
JavaScript, not the other way around.
Thanks.

Hello,
You need to register the JavaScript function as a callback to
a Flex action. You can do this from javascript in a function that
gets called when the flash movie has finished loading. Then, when
the Flex event is triggered it will execute the JavaScript
function.
Hope this helps,
Cristian

Similar Messages

  • Tomcat shutdowing when remote object is calling secondtime from flex to blazeds

    Hi All,
    I am new to flex and started working on that.now i called one remote object from flex through blazeds.its working fine but when i call second time tomcat is  shutdowing .again if i start tomcat it is working fine.
    what is the problem does any one helps?
    sudheer

    Thanks for the tip Joe.
    It's not quite what I was looking for, but it gave me some ideas.
    The blog post describes how to create your own server to handle the file stream. With BlazeDS & Java EE app server there's no need to implement the low level stuff.
    One option would be to read the data on Flex side in chunks and make a request to send each chunk at a time, but I don't know whether this helps at all. Might just slow down the network.
    Another option is to write a custom adapter for BlazeDS endpoint, but I don't know enough details on this to say is it possible or not.
    Third option is to use regular servlet code and Apache Commons FileUpload module.
    Still interested hearing opinions from people working with BlazeDS.

  • Calling webservice from Flex?

    Hi,
    I get the error when I call webservice from Flex.Can you tell
    me why this happen?
    Thanks
    Mark
    [RPC Fault faultString="Security error accessing url"
    faultCode="Channel.Security.Error" faultDetail="Destination:
    DefaultHTTP"]
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::faultHandler()
    at mx.rpc::Responder/fault()
    at mx.rpc::AsyncRequest/fault()
    at DirectHTTPMessageResponder/securityErrorHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/redirectEvent()

    I think this means that the source of the web service does
    not have a crossdomain.xml file on it allowing access from your
    site. Try adding one to the root of the server and see if that
    fixes the problem.
    hth,
    matt horn
    flex docs

  • Calling Javascript from JApplet

    Does anyone know of a foolproof way of calling Javascript from an Applet on a Web page. I have heard of the JS Object but can't find much aboout it. Does anyone have any ideas?

    or...
    http://turtle.ee.ncku.edu.tw/~zulu/research/seminor02/
    http://turtle.ee.ncku.edu.tw/~zulu/research/
    JRG

  • Calling javascript from 10g Forms

    Hi,
    RE: How do I call Javascript from Forms 10g (v 10.1.2.0.2)
    Sorry if this post is to the wrong audience but was wondering (as I haven't had an update from the Forms forum) if anyone could tell me how to know
    when a user was navigating away from the current open form because they had entered a new URL in the address bar and were trying to navigate to it?
    The reason for this is that i would want to prompt the user to confirm that they wanted to exit the form as potentially they would have a record (in the form)
    flagged as being updated and as such no other user (including themselves) could susbequently access it.
    So, I'm basically wanting to know if there is a way (by using Javascript?) to catch the fact that the user is about to navigate to another web page.
    Kind regards,
    Tom

    Hi John,
    Well, I'm chasing my tail about this one as not getting any response from any area.
    Apart from the Oracle Forms forum, any other one that you would suggest?
    Kind regards,
    Tom

  • How to send xml to javascript from flex?

    Hello,
    I am using Flex Builder......I read blogs and wonderful tutorials on adobe website. But I found that I can only have data from Flex to script placed within main.template.html file.....when i tried to get same data by in my other .html or .aspx page, it did not work. Another thing I noticed in following tutorial
    http://blog.flexexamples.com/2008/03/09/calling-javascript-functions-from-your-flex-applic ations-using-the-externalinterface-api/
    is that we placed <iframe> in our html page to host flex object instead of using <object> tag etc.
    Please just let me know how to do very same thing as defined in tutorial but by hosting out flex object using <object><embed> tags etc and how to get data into our .html or .aspx page rather putting javascript (to receive data) in main.template.html file generated by Flex Builder...???

    Thanks for replying,
    Now I am facing another problem....I have added a script tag in index.template.html file that also contains other useful code used in my aspx page. I wanted to have that reply on my aspx page. So I placed all the script in a Core.js file and also the recieving method from flex in same Core.js file. I thought this way i will be able to access data coming from flex project to my aspx page. But something strange is happening, when i run .html file in bin-debug folder it fires receiving method placed in Core.js........but when I host that flex project .html file in my aspx page, it is not firing method. And also not firing when I run .html in bin-release folder....what am I doing wrong?

  • "ReferenceError: "myIpAddr"  is not defined, when call JavaScript from java

    Hi developers,
    My java application was trying to issue a http request via proxy auto-config. So, I did below jobs
    1. Read URL of *.pac from registry
    2. Call FindProxyForURL from java, the code is like below
                   ScriptEngineManager factory = new ScriptEngineManager();
                   ScriptEngine engine = factory.getEngineByName("JavaScript");
                   engine.eval(autoProxyScript);
                   Invocable inv = (Invocable) engine;
                   Object obj = inv.invokeFunction("FindProxyForURL",
                             "http://java.sun.com/",
                             "java.sun.com");
    However, I got "ReferenceError: "myIpAddress" is not defined
    I can not change the script on server to add a function like "myIpAddress", I am wordering why IE or mozilla can call it successfully and get proxy server, while Java failed to do that.
    I got a ugly solution by calling "pacparser" by jni. But I really hope I can get a better solution.

    A .pac file is a JavaScript, but it requires some functions to be defined in the executing context to work (i.e. you must define those).
    From the example on the Wikipedia page there's at least "shExpMatch" and "isInNet". "myIpAddress" seems to be another such candidate.

  • Calling Javascript from ABAP webdynpro application

    Hai All,
    I want to call a Javascript from ABAP-Webdynpro application. If anyone has done this. Please let me know.
    Thanks & Regards,
    H.K.Hayath Basha.

    go to window
    create suspend outbound plug and resume inbound type
    when create an outbound plug of Suspend type a parameter Url is automatically created,
    fire the outbuond plug with the Url to a BSP page where you have JavaScript.
    and fromt he BSP navigate back to WDA again which you can do using by reading the url parameter sap-wd-resumeurl, which contains the WDA URL
    Abhi

  • Calling javascript from a button

    Good morning everyone!
    I need to add a message box that asks the user a confirmation to delete information. So I want my delete button to call the javascript necessary to confirm the delete and then delete.
    My problem is in calling the javascript. I'm able to do so by using an image for my button and in the image attributes add:
    onclick="javascript:confirmDelete('Are you sure you to delete?');"
    This works perfectly, except for one thing: I don't want to use an image for the button. It doesn't fit with the rest of the application.
    I know it can work, because Oracle is using it on this page:
    http://apex.oracle.com/pls/otn/f?p=37719:8:3069181226556730::NO:::
    So how can I call my javascript from an ordinary button?

    I have a related question:
    How can I access the BROWSER_LANGUAGE in javascript? With my method of calling javascript, I didn't find a good way to pass variables to the function that I call.

  • How to call javascript from java application

    How can we call a function written in javascript from java application (core java not applet)? How will java identify javascript?
    Is there any such options ?

    Try creating a page called launcher.html (for example). That does this:
    <html>
    <head>
    <script language="javascript">
    windowHandle=window.open("http://www.javasoft.com", "", "height=700,width=1000,status=no,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=5,left=5");
    </script>
    </head>
    </html>Now you launch IE (or whatever) with this page using the Runtime class. After x seconds (after the second window has been launched) try killing the process. Hopefully it will kill the original window you opened and not the window you popup (the one without toolbars etc)
    It might kill both windows but I can't be bothered to test it. If it does you'll have to try and find a workaround.

  • Calling javascript from subdomain

    I have the swf file on the main domain and I call them from a
    subdomain. All works fine except javascript. Does anybody ahve an
    idea why? The same code that I use on a subdomain I use on the main
    domain too, and there javascript calls work.
    Thanks

    or...
    http://turtle.ee.ncku.edu.tw/~zulu/research/seminor02/
    http://turtle.ee.ncku.edu.tw/~zulu/research/
    JRG

  • Calling JavaScript from rangeChangeListener

    Hi,
    I can not call javaScript function from my rangeChangeListener attribute on my table. Is there a way to call JS somehow?
    My situation is following:
    I have table with tableSelectMany. I am condittionaly rendering tableSelectMany checkboxes.
    Sometimes I have no checkboxes in current page (but there is checkboxes in other pages).
    The problem is that Select all and Select none functionalities (that comes automaticaly with tableSelectMany) are not disabled for that kind of pages, so I get error when trying to select when theres nothing in the page to select.
    So I need javascript on rangeChangeListener event to check if I have checkboxes and if not - disable them.
    It looks like ADF bug. Maybe somebody had the same sort of problem or have ideas on how to handle this situation?

    Hi,
    in this case you either go for a terrible JavaScript hack, or get rid of it alltogether
        <afh:head title="DepartmentsTable">
                <style type="text/css">
                    .x2l {display:none;}
                </style>
        </afh:head>Frank

  • Calling HTTPService from Flex

    Hi,
    I know how to call a HTTPService in actionscript as follow.  I was wondering how to call HTTPService in Flex (not from actionscript).
        post_submit_tn_service.send();
        <mx:HTTPService id="myservice"
        </mx:HTTPService>

    Hi,
    Here is my problem.
    Let's assume I have two mxml files.
    The mxml file2 contains HTTPService which is called in a ViewStack from file1.
    When ViewStack is set to file2 for the second time (to update datagride), createComplete in file2 is not being called. So, no HTTPService is called when ViewStack is set to file2 for the second time.
        <!-- file1 -->
        <mx:ViewStack id="vsMyStack" x="0" y="0" width="100%" height="100%" >
              <mx:Canvas id="file1" label="Login" width="100%" height="100%">
             </mx:Canvas>
            <mx:TabNavigator id="viewstack1" width="100%" height="100%">
                <views:file2 width="100%" height="100%"/>
                <views:file3 width="100%" height="100%"/>
              </mx:TabNavigator>
        </mx:ViewStack>
    <!-- file2 ->
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();">
        private function init():void
            post_service.send();
        <mx:HTTPService id="post_service"
            url="http://localhost/prod-ar/webservices/get_day_of_year.php"
            method="POST"
        </mx:HTTPService>
    </mx:VBox>

  • Embedded .swf's calling javascript from air container

    1) I have an html/ajax air app version 1.5.1
    2) This air app embeds .swf files from an external source / web server & plays the embdded .swf inside air.
    3) The embedded .swf file has a button with an onClick event
    function onClick(event:MouseEvent):void {
    ExternalInterface.call("someJavascriptMethod()" );
    4) The javascript method to be called is already parsed inside the containing Air app and is waiting to be triggered.
    5) When the onClick is triggered, the following error is thrown.
    Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX,
    Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
    at Error$/throwError()
    at flash.external::ExternalInterface$/call()
    at stress_fla::MainTimeline/onClick()
    6) On investigation I found on your livedoc's website that Air does not support the ExternalInterface.call method.
    http://livedocs.adobe.com/labs/air/1/aslr/flash/external/ExternalInterface.html
    Look for Note: Adobe AIR currently does not support the ExternalInterface class.
    7) Does anyone here know how I can get an embbeded .swf file to call javascript methods in the containing air application? I have had a look at the getUrl method but this is now longer supported & even the FS command but still to no avail. I may have a work around by inserting a DOM element over the top of the embedded .swf but this is not an elegant solution & want the .swf to talk directly to the air app container.
    All help & comments welcome
    Thanks
    Kyle
    Additionally I have found
    http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7ed4 .html
    Using the Html Loader so that Actionscript can call/manipulate the dom objects. At first I was whopee but then I tried the examples listed in the help. The HTMLLoader class is only available in Air. When trying to use import flash.html.HTMLLoader; Flash C4 complains that the Definition cannot be found on compile time & therefore does not export my movie correctly. Has anyone else had this problem or have a solution??
    More additions:
    The reason the htmlLoader class was not compiling was due to the source action script provided being ActionScript 2.0 - the htmlLoader class is a 3.0 library.
    However, after more investigation I have found the current structure.
    The air app has an html base/root doc. On periodic javascript events - .swf files are downloaded via
    videos = new air.Loader();
    netStream     = new air.URLRequest(path + file);
    videos.load(netStream);
    So now I have a html container in my air app that creates a new air.Loader which downloads the external .swf file in which I want an onClick event in the action Script of the downloaded .swf file to call a Javascript method of the parent air container. Simple yea?
    Or am I making life to hard for myself? Have been looking at the security snadboxes but I don't see how I can get the .swf file to talk nicely with the outer air container. Please help if able.
    Thanks
    Kyle

    Hi Kenneth,
    Your explanation makes sense.
    I have a big JavaScript file full of special mathematical functions written by a mathematician who only knows how to program in Javascript.
    I need to call the Javascript functions from within an ActionScript library, which obviously has no UI, and thus HTML and/or HTMLLoader are not an option.
    Any ideas?
    TIA,
    mlavie

  • Calling javascript from procedure

    Hi folks
    I am trying to call in a javascript from an onSubmit procedure after computations and validations. This process is conditional and fires on a button click.
    Heres the procedure body :
    begin
    htp.p('<script language =javascript'>)functiondoSomeThing(1,2);</script>');
    end;
    This is not working. I tried removing the branch from the on click of that button as well but, then it says error no page to branch to. Any possible way in which I can see the effects of the above procedure ?
    I want this javascript to be in procedure only, since this is supposed to act after computations and validations.
    Thanks
    Shantanu

    Hi Shantanu,
    Javascript is client-side code; computations, validations, processes and branches are server-side. In order for the javascript to run, therefore, it has to be on the rendered page - you can not call it after computations and validations without reloading the page with the javascript in it somewhere.
    If the script should only be on the page after the user clicks a specific button, you should set the button to set a value for a hidden item and use this to conditionally display the javascript. I tend to put scripts into a region on their own and use Conditional Display appropriately.
    What should the script do "after computations and validations" that can not be done by a page process?
    Andy

Maybe you are looking for

  • Is there a comment feature in Pages for iPad?

    Hey all you iPad owners. Is there a comment feature in Pages for iPad? There is one in Pages '09 that I use all the time. Not having that feature in the iPad version of Pages could be a deal breaker for me buying an iPad. Thanks in advance for your h

  • Time changes made in iPhoto not showing in Photos

         I've scanned a lot of physical family photos from when I was a child into iPhoto and changed the dates so they show in iPhoto on the correct day. So Xmas day 2000 showed up on 25 December 2000 as you would expect. Since importing into the new Ph

  • Import/export to memory and global variables

    Hi, Im working on some functionality using import/export to memory. One of the statements is: import gf_memid_exit = g_exit_flag gf_memid_result = t352r from memory id 'ZREV_EXT'. Im using global variables to contain the cluster names. But this is no

  • 12.1.1 PO Output for Communication errors all POs created after upgrade

    Hi All - We are in the middle of upgrade testing and have encountered a critical issue with "PO Output for Communication (POXPOPDF)." All POs created after the upgrade are completing with error. We are able to generate pdf output for POs generated in

  • Write an imageIcon or buffered image to file (or to system clipboard)

    hi all, I just want to write an imageIcon to file, or a bufferedImage. Anyone have any ideas. Or pointers of where to start?