ExternalInterface

Simply, it's not working.
What happens is PHP and MySQL populate the list of all
available songs to play. JavaScript creates the playlist when the
user clicks the songs they want the when the user chooses to play a
song, the url, artist, and song title are transferred to Flash via
ExternalInterface.
The AS works in flash, but not when it's integrated with
JavaScript.
Code for the .php file and .as file are provided.
Thanks for anyone's help.

OK...
I want the web coder to be able to have something like this
in their code
(javascript)...
newText = getTheText();
in the flash file there is a text box with an instance name
of 'myText'
What I ultimately need is an easy way of getting 'newText =
getTheText();'
to set the variable 'newText' as the text box content.
Tim
"kglad" <[email protected]> wrote in message
news:fb97d8$7b$[email protected]..
> what's the problem? you can send parameters with the
call method.

Similar Messages

  • Problem with ExternalInterface.call and Internet Explorer

    Hi, I´m developing a site, (
    www.gen-studio.com/avelart2
    ), and I´m using a swf to display a set of thumbs that when
    clicked show an item and its description on the browser, those
    items might be images or video, everything works fine with the
    images.
    And actually it works fine with the videos too, when using
    Firefox, but when I test the page on Internet explorer it just
    doesn’t work!
    On principle let me describe how it´s supposed to work,
    a thumbnail when clicked sends an id number to javaScript using
    ExternalInterface.call(“myFunction”,myId); -I´m
    using AS3 for the swf´s-
    the javaScript file has already loaded (ever since$(
    document).ready) a XML file which uses to match the id with a file
    and the description, if the item to show it´s a video, then it
    creates a variable which holds a string with the proper html to
    embed a swf (a swf movie player that resides just next to the HTML
    file), when loaded, the swf movie player uses
    ExternalInterface.call() to ask for the source of the video that
    has to play, and that function is as follows:
    setVideo: function(){
    alert("hola");
    return comun.miVideo;
    (The alert(“hola”); is just to test that the
    function is being called), which it is, but it returns null as a
    value instead of the proper string, and this happens only on
    internet Explorer, but works correctly on Firefox.
    I´ve been reading all day about the subject and found a
    few interesting things, which though have made me narrow my
    problem, they haven´t just provided me with a solution, what I
    found so far:
    -I must have in account flash security issues: Checked (my
    actionScript follows:)
    import fl.video.*;
    import flash.external.ExternalInterface;
    flash.system.Security.allowDomain("*");
    var vid:FLVPlayback = this.miPlayer;
    vid.source =
    flash.external.ExternalInterface.call("comun.setVideo");
    -ExternalInterface and Internet explorer don´t work
    properly when tested locally: Checked (I have a server on my PC and
    I´m testing the site as well in the above direction).
    -The object tag holding the swf must have a proper id
    attribute: Checked.
    -It´s super important the way the object tag is formed:
    Checked, and I also tested the tag separately (I put it directly in
    the HTML instead of adding it via javaScript) and it worked as
    expected in both Firefox and Internet Explorer, which leads me to
    believe:
    -I read somewhere that if you add the object tag by using
    innerHTML or appendChild, returning values from javaScript to swf
    won´t work, but I couldn´t find an explanation nor a
    solution.
    Well, as I said now I´ve been looking all day for an
    answer, so I really hope you can help me or give me some advice on
    the subject, thank you so much for your time!

    Hi! it solved itself !! (nahh, I wish), but it indeed had a
    solution, it was something quite simple, and I don´t really
    understand why it was not working in the first place, but here is
    the thing:
    I´m learning jquery and this is the first proyect
    I´m officially using it, so I was using
    $('#myDIV').append("string"); to embed the swf, (and it was working
    perfectly on Firefox), so since I had narrowed my problem to those
    lines, I decided to try some good-old-fashioned-javaScript and
    changed it for: var myDiv =
    document.getElementById('thatParticularDiv'); myDiv.innerHTML =
    ('string'); and it worked both in Firefox and IE !!!!!! :)
    I´m quite happy about it, and if someone knows
    what´s the issue with my jquery approach I would love to hear
    it. THANKS !!

  • Strange IE ExternalInterface Bug: "Object does not support this property or method"

    We have an application on a relatively slow server (I mention
    the speed because it may be relevant).
    The app is flash 8 and uses ExternalInterface to call a
    javascript function in its parent page. It also used the
    ExternalInterface to receive a call from another function. These
    calls happens separately (the outbound one calls up a list view of
    items, clicking on an item calls up the details in the flash
    movie). In between the calls, the flash movie is hidden by moving
    it off screen using absolute positioning.
    On my local development box (Windows XPSP2) this works fine
    in both directions.
    On our production server (LAMP) this works fine in both
    directions in Firefox 1.5 and 2.0
    BUT while the outbound call from Flash to the page works fine
    in Internet Explorer 6 or 7, the call back from the page to the
    flash movie fails with the error messgage "Object does not support
    this method or property"
    We've tried not hiding the flash so it is always present on
    the page and still the browser > flash communication breaks in
    ie.
    We've tried using both the Adobe active content script and
    swfobject to embed the flash in the page with no difference in the
    resultset. In truth we've given up and gone to a two-page solution,
    reloading the flash from the start each time but I wondered if
    anyone had encountered a similar issue? Can't see why it would work
    perfectly in FF but not in IE.

    Not sure if this is your problem, but you do reference the
    Flash object
    differently, depending on the browser. In a video player we
    made, that uses
    JS to communicate back to Flash, I use a function like this
    to modify the
    variable depending on the browser:
    function changeVideo(xname){
    //ff
    if(window.vplayer){
    window.document["vplayer"].SetVariable("theXML", xname);
    window.document["vplayer"].GotoFrame(2);
    window.document["vplayer"].Play();
    //ie
    if(document.vplayer){
    document.vplayer.SetVariable("theXML", xname);
    document.vplayer.GotoFrame(2);
    document.vplayer.Play();
    The Flash is in a <div> named 'vplayer'
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Can't Use Dreamweaver Flash Embedding with ExternalInterface

    I've been trying to use ExtermalInterface to call ActionScript 3 functions from JavaScript and have been having a problem when embedding SWF files using Dreamweaver. When I use the sample code at the bottom of the ExternalInterface docs page (http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/external/ExternalInterface.html) the JavaScript/ActionScript function calls work fine. But when I insert a SWF with Dreamweaver CS4 they don't. They do actually work in Internet Explorer 8 but not in Firefox 3.5, Safari 4, or Chrome 3.
    The problem has to do with the the way the SWF embedding is done. On the ExternalInterface page mentioned above a different form of the <object/embed> tags is used than in DW. Here's the sample code from the docs page:
         <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                 id="ExternalInterfaceExample" width="500" height="375"
                 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
             <param name="movie" value="ExternalInterfaceExample.swf" />
             <param name="quality" value="high" />
             <param name="bgcolor" value="#869ca7" />
             <param name="allowScriptAccess" value="sameDomain" />
             <embed src="ExternalInterfaceExample.swf" quality="high" bgcolor="#869ca7"
                 width="500" height="375" name="ExternalInterfaceExample" align="middle"
                 play="true" loop="false" quality="high" allowScriptAccess="sameDomain"
                 type="application/x-shockwave-flash"
                 pluginspage="http://www.macromedia.com/go/getflashplayer">
             </embed>
         </object>
    In DW, instead of an <embed> tag a second object tag is inserted. I did find that by manually giving the second <object> tag its own ID (a different ID from the one given the first tag by DW I could make the function call work in FF. But you would then have to choose the ID based on the browser. And, worse, that technique doesn't work in Chrome or Safari.
    So, the workaround seems to be to use the style of embedding used on the ExternalInterface page. But, I don't like that approach for several reasons. First, the page  won't tell the user they need to upgrade their FlashPlayer if that's a problem. Second, you have to manually copy/past the embedding code instead of using DW's nice menu option. And I suspect there may be other benefits to the DW approach,
    So, is there a way to make the DW embedding style work with ExternalInterface in all the major browsers??
    David Salahi

    Very interesting, thanks for your insight. Dreamweaver does seem to be a black sheep in this regard. Curiously, one of the reasons I wanted to stick with DW is because it highlights the <embed> tag in yellow—which normally means an HTML error. Not being entirely up on the ins and outs of the embed tag I thought maybe it's deprecated or something so wanted to avoid it. But now, I've found that it's apparently the right way to do things.
    I did a little testing; here are my results...
    My SWF was originally generated in FlexBuilder (as an ActionScript project) so I copied over the Flex-generated HTML page and modified it for use with ExternalInterface. That works fine in all four of the browsers I mentioned in my original post.
    Next, I grabbed an HTML page generated by Flash's Publish menu option and made the same modifications. Again, everything was copacetic.
    Each of the three tools (Flash, Flex & Dreamweaver) generate different HTML code for embedding a SWF file and only two of them work with ExternalInterface. I guess I'll steer clear of Dreamweaver's Insert-> Media -> SWF menu option in the future. This cost me an entire day of hair-pulling.
    But thanks for your tip!
    David Salahi

  • ExternalInterface.call Acrobat 9

    I am having trouble with this script. I can not get it to
    pick up text from the pdf. Not sure if the problem is on the Java
    side or the AS side but I think the AS2.0.
    Acrobat 9
    /* JavaScript */
    var GuestNamez = this.getField("TestText");
    // Get hold of the first Flash object on the second page
    var annot = getAnnotsRichMedia(0)[1];
    if ( annot )
    // if exists, call the function called "GuestNam"
    // and pass an item ID as an argument
    annot.callAS( "GuestNam", GuestNamez.value);
    Flash
    /* ActionScript 2.0*/
    import flash.external.*;
    var realFunction:Function = setState;
    ExternalInterface.addCallback("GuestNam", null,
    realFunction);
    function setState(stateData:String):Void {
    GuestsNames.text = stateData;
    Any help would be great thanks.

    You might want to look in or ask in the Acrobat SDK forum.

  • ExternalInterface.available returns false on a Mac

    Hi there!
    I'm triyng to get the browsers back-button to work with my
    flash site. The general principle is this:
    There is an index.html page containing an (not yet) hidden
    Iframe and the flash movie.
    The Iframe contains page A, which starts with JavaScript
    calling a BACK-function on the index-page.
    The BACK-function triggers an AS-function in the flash-movie
    that activates its own back-button, and then changes the URL of the
    Iframe to Page B. This causes a new History to be added to the
    browser.
    The flash movie now contains 5 frames (labeled in the middle
    of the stage) and two navigation buttons: back (Terug) and forward
    (Verder). Those buttons do exactly what you'd expect them to do
    (prevFrame and nextFrame).
    On a PC (IE) this seems to work pretty well. But on a mac
    nothing seems to work propperly.
    I've got a testpage at:
    http://www.multimediamatters.nl/test
    Here's the code I have on the first frame.
    stop();
    _root.terug.onRelease = function(){
    prevFrame();
    terugF = function(){
    trace(_root._currentframe);
    if (_root._currentframe > 1){
    _root.terug.onRelease();
    else {
    _root.getURL("javascript::history.go(-2)");
    import flash.external.*;
    var isAvailable:Boolean = ExternalInterface.available;
    var txtField2:TextField = this.createTextField("txtField",
    this.getNextHighestDepth(), 300, 0, 200, 50);
    txtField2.border = true;
    txtField2.text = "ExternalInterface.available =
    "+isAvailable.toString();
    var methodName:String = "goHome";
    var instance:Object = null;
    var method:Function = terugF;
    var wasSuccessful:Boolean =
    ExternalInterface.addCallback(methodName, instance, method);
    var txtField:TextField = this.createTextField("txtField",
    this.getNextHighestDepth(), 0, 0, 200, 50);
    txtField.border = true;
    txtField.text = "ExternalInterface.addCallback =
    "+wasSuccessful.toString();
    Somehow the ExternalInterface doesn't seem to get loaded. Any
    suggestions to solve this?
    Thanks in advance.
    Yours,
    Andra
    P.S.
    The condition
    if (_root._currentframe > 1){ doesn't work on a PC
    either. It always calls
    _root.terug.onRelease(). I can't figure out why...

    Woops!! I guess I wasn't paying enough attention...
    On a mac using Internet Explorer, both
    ExternalInterface.available and
    ExternalInterface.addCallback return false. Using the back
    button does reload Page A into the Iframe, but doesn't execute any
    AS-functions.
    Using Safari, they both return true. However, using the back
    button reloads the entire index.html instead of loading Page A back
    into the Iframe. This means the flash-movie is reloaded aswell, so
    you're automatically back at frame 1.
    Is there any way I could get this working properly?
    Yours,
    Andra

  • Intermodule Communication in flex 3 using ExternalInterface

    I have 2 modules, module A and module B, I want to use functions defined in Module B into module A.
    How can I do this with ExternalInterface?

    For local connection I will have to take instance of that module, which will unncessarily increase swf size
    Consider a case of complex project wherein there are 100 modules passing data amongst each other.
    Each module having number of functions
    Wii it be a correct way to take instance of modules?
    Instead writing a common JS file would resolve my problem, everytime I will have subscribe and publish messages on pagebus.Few lines of code (4-5) for intermodule every communication.No instance nothing.
    Taking instance is the only approach for direct intermodule communication.
    Read more about pagebus at
    http://flex.sys-con.com/node/838290

  • Geturl or ExternalInterface does not work in Firefox 2.0

    This works in IE7:
    on (release) {
    var callJas:String = 'javascript:abrir_faleconnosco()';
    getURL(callJas);
    But when using the same html with flash in Firefox, the Flash
    never makes the call to the javascript function. I tried also with
    button_1.onRelease =function(){
    ExternalInterface.call("window.open","
    http://www.adobe.com", "win",
    "height=200,width=300,toolbar=no,scrollbars=yes");}
    But again works in IE7 but not in Firefox 2.
    In the publishing i changed the local playback security to
    access network only to see if it made any difference.
    Can any one help me?

    Is there any chance that you have Javascript disabled in
    Firefox?

  • ExternalInterface.call not working

    ***Flash CS4 -published to AS3.0 and Player  10***
    I am having a problem using ExternalInterface.call to a javascript  function. I have used this method many times in many places and at some  point during this project, it was working, but now it stalls my Flash  file when executed.
    I have the function:
    var initialize=function(){
    ExternalInterface.call("SCOInitialize");
    statusTxt.text="initializing";
    On my html page, there is a SCOInitialize function that works perfectly  if I call it via the html page:
    <body onLoad="SCOInitialize()">
    </body>
    When I make the call using flash...
    initialize();
    ...the Flash file just gets hung up and it actually wont execute the  second line of code in the function: statusTxt.text="initializing";
    What is the deal? I can't for the life of me figure out why it won't  work anymore!!!
    Also, I have checked to see if the ExternalInterface is available, and  it returns "true".

    I am testing locally using an HTML file that virtualizes an LMS. I have used is many times in the past. I originally used javascript that I normally create for these circumstances that always worked in the past, then switched to trying to use the Javascript that Flash created. In either case, the call to the Initialization function onLoad from the HTML page itself worked fine, both actually having different Function names, but perform the same function, while the ExternalInterface call to both fails.

  • ExternalInterface problem in IE

    I cannot get ExternalInterface to work in either IE 6 or 7
    – either from Flash to the HTML page or vice versa.
    I have DIVs containing various SWFs that can be opened and
    closed by the user. Many of them need to be reset when a user
    closes them, an some need to be told to play when they're opened.
    This works absolutely fine in Firefox (Mac or PC), but always fires
    an error in IE: "Object doesn't support this property or method".
    I've searched high and low for a solution to this, but all I
    find are suggestions regarding the SWF being inside a form (not
    applicable), or just saying "it works for me". It doesn't work, and
    I've tried it on various platform configurations.
    I've tried it using Adobe's AC_FL_RunContent and SWFObject
    with the same, unsatisfactory result. Surely there must be a
    solution to this? Has nobody else come across the problem?

    I have used the information provided in the following link and it has worked for me using AS3 in IE7 and FF.
    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683

  • ExternalInterface.call problem with object-orientation

    Hi
    I am using an swf inside a PDF. In a PDF-context the ExternalInterface-class works much the same as it does within a website. So far calling a function in the document-script works.
    The thing now is, that I really try to use an object-oriented approach as often as I can. In this case I have a function I could call using
    var jsCaller:Object = ExternalInterface.call("myFunction",parameters);
    This works as expected.
    However, I have now made that function a method in an object, so I can access it within JS using dot-notation: myCoolObject.myFunction(); This works as well, so the problem is not the function itself. However, the call
    var jsCaller:Object = ExternalInterface.call("myCoolObject.myFunction",parameters);
    does not work.
    This means there's either something I'm missing, or it's a limitation of ExternalInterface, or it's a limitation of externalInterface in a pdf-context.
    Anyone to enlighten me?

    If EI calls eval it should be able to resolve the object-path. However, this doesn't seem to be the case. Also note that my parameter is an array, so this probably wouldn't work, even if the syntax did.
    Anyway, I tested your syntax in my PDF, and it showed the same behaviour as before (i.e. the function in which the EI-call was placed could not be executed, and acrobat claimed there was no such function). It didn't work with my normal function, and not even with a simple console.println-statement that way. So in PDFs it definitely doesn't work like that.
    But thanks for the suggestion!

  • ExternalInterface is not working?

    Hi all,
    I have an issue with ExternalInterface.call, it's working fine in IE but not in Chrome I don't know why? is there any solution? please let me know. Bellow you can find the code. Thanks in advance.
    AS Code:
    import flash.external.ExternalInterface;
    var req:String
    var msg:String
    site_btn.addEventListener(MouseEvent.CLICK, gotowebsite)
    function gotowebsite(event){
            req = "http://www.google.com/"
            if( ExternalInterface.available ) {
                     Security.allowDomain(req);
                     ExternalInterface.call( "downloadFileFromAS", req );
                     msg="good"
            }else{
                    msg="error in ExternalInterface"
          msg_txt.text=req
    JS Code:
    <script type="text/javascript">
         function downloadFileFromAS(_fileURL ) {
               window.open(_fileURL,"_blank");
    </script>
    Thanks and Regards
    Santhosh Kumar M

    Change the value of "allowScriptAccess" param to "always" from "sameDomain" in the generated HTML, if you are testing your html from the local file system. If you host it on a webserver, this would not be required.
    Take a look @ http://helpx.adobe.com/flash-player/kb/changes-allowscriptaccess-default-flash-player.html #main_DIAGNOSIS for more details.
    -Dharmendra.

  • ExternalInterface not returning chinese characters

    I've got a Flex application embedded in a PDF.  Also in that PDF is a field (hidden text field) called Data containing XML that happens to contain chinese characters.  The encoding for the XML data is UTF-16. To retrieve the data, I make a JS call (getData) using ExternalInterface.  The JS is simple:
    function getData()
      var data = this.getField('Data').value;
      return data;
    I also inserted before the return an alert to display the data.  The chinese characters were present and displaying as expected:
    In my flex application I make the following call:
    var resultXML:XML = XML(ExternalInterface.call("getData"));
    However, the resulting XML appears to not be read as UTF-16, and the characters displayed look like:
    Is there something special I have to do to get the chinese characters correctly passed through from the ExternalInterface call?

        OK, did not know that "Arial Unicode MS" font is only distributed with Microsoft Office, was looking into relying on this font in case if "simsun.ttc" font is not available at the user's system, by using the following:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   minWidth="1024" minHeight="768"
                   creationComplete="resourceManager.localeChain = ['zh_CN']"
                   layout="{new VerticalLayout()}">               
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/halo";
            s|Label {
                fontFamily: "Arial Unicode MS, SimSun, Arial";            
        </fx:Style>   
        <fx:Script>
            <![CDATA[
                import spark.layouts.VerticalLayout;
            ]]>
        </fx:Script>
        <s:Label id="sparkLabel" text="伜-伞伟传伡伢伣伤伥伦伧伨伩伪伫伬伭-伝"/>   
    </s:Application>  
    Tough decision ahead, but accordingly to  the survey at codestyle.org (2000 participants from 2007 year and onwards), Arial Unicode MS is present at 62.53%% system surveyed.
    ps
       My current install of Windows XP already includes the install of Microsoft Office 2007 and I've also enabled/disabled the support of East Asian languages, thus the content of  my "fonts" folder differs now significantly from "clean" Windows XP install version.
    Nevertheless I found the page with comprehensive lists of standard fonts installed with different releases of Windows that looks viable here:  http://www.kayskreations.net/fonts/fonttb.html

  • Problems with ExternalInterface

    I am trying to have a Flex2 TitleWindow communicate with
    Javascript and then have that Javascript communicate back with the
    ActionScript in the TitleWindow.
    Calling Javascript from ActionScript is working perfectly,
    however, I have not yet been able to successfully call an
    ActionScript method from Javascript.
    My setup is fairly involved, but here are the basic
    components. I would be happy to provide any additional information
    that could help.
    I have a creationComplete event in my TitleWindow which calls
    an initialization function that registered callbacks and then a
    callback function defined in the same TitleWindow.
    public function init():void {
    if (ExternalInterface.available){
    ExternalInterface.addCallback("testCallback", testCallback);
    Alert.show("Callbacks are registered");
    else{
    Alert.show("ExternalInterface was not available");
    public function testCallback():void {
    Alert.show("Received callback from Javascript");
    Then when the user clicks a button on the TitleWindow, I do
    the following:
    ExternalInterface.call("jsFunction", "foo", "bar");
    In my Javascript, I have the following:
    var jsFunction = function(string1, string2){
    alert("Received: " + string1 + ", " + string2);
    flexObject.testCallback();
    In my Html, I have the following to imbed flex
    <object id='flexObject' codebase='
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'
    height='100%' width='100%'>
    <param name='src' value='flexapp.swf'/>
    <param name="allowScriptAccess" value="always"/>
    <embed name='flexObject' src='flexapp.swf'
    allowScriptAccess='always' pluginspage='
    http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
    height='100%' width='100%'/>
    </object>
    Now, I can load the html page just fine and everything look
    great and is functional. When I go to the TitleWindow in question
    and click the button that calls the Javascript, it works perfectly
    and I see the Javascript alert box displaying "Receiving: foo,
    bar". However, I never get any response from the ActionScript
    callback that should be called at that point by the Javascript.
    Looking at it more closely, I have been able to determine
    that flexObject.testCallback is undefined at the point I try to
    call it in my Javascript. Javascript is unable to see that this
    method exists. If I try to use Firebug to trace the Javascript side
    of things, it crashes at the flexObject.testCallback line.
    I have tried doing:
    flexObject.testCallback();
    document.getElementById("flexObject").testCallback();
    testCallback();
    None of them work. Has anyone had luck with this? I have
    tried it with FireFox 2 and IE 6 with the same result.

    Never mind, it was some crazy-*** unrelated problem where JavaScript working in IE didn't work in FF.

  • PSEvents via ExternalInterface

    Hello,
    I'm trying to add in Photoshop Extended an Event listener for Count Tools items, so each time the user adds one, something should happen. Alas, it doesn't.
    In Extension Builder I've added the CSHA lib.
    PSEvents are not well documented in the reference, imho, compared to AI events for instance, where there's at least a line of explanation. Anyway, there's no mention of counters, nor in the Photoshop Event Codes table.
    As CS SDK Help suggests (Photoshop Guide page, in the Product-specific Guide), I have to use ExternalInterface; ScriptingListener code for Count adding is as follows:
    // =======================================================
    var idcountAdd = stringIDToTypeID( "countAdd" );
        var desc4 = new ActionDescriptor();
        var idX = charIDToTypeID( "X   " );
        desc4.putDouble( idX, 1917.500000 );
        var idY = charIDToTypeID( "Y   " );
        desc4.putDouble( idY, 413.500000 );
    executeAction( idcountAdd, desc4, DialogModes.NO );
    // =======================================================
    So in the mxml I've added:
    private const COUNTER:int = Photoshop.app.stringIDToTypeID( "countAdd" );
    private function onCreationComplete():void
         model = AppModel.getInstance();
         CSXSInterface.instance.evalScript("PhotoshopRegisterEvent", COUNTER);
         ExternalInterface.addCallback("PhotoshopCallback" + CSXSInterface.getInstance().getExtensionId(), myPhotoshopCallback)
    private function myPhotoshopCallback(eventID:Number, descID:Number):void
         var desc:ActionDescriptor = new ActionDescriptor();
         desc.fromID(descID);
         switch (eventID)
              case COUNTER:
                   trace("Counter added")
                   break;
    And it doesn't work at all. Moreover, I keep getting "PSHostAdapter not found in the Adobe Photoshop CS5 plugins. It may not be available for the Host Adapter libraries." error from Flash Builder.
    What's wrong?!
    Any help is really appreciated!
    Thanks in advance
    Davide Barranca

    Listening for two events instead of only one make it work:
    private const COUNTER:int = Photoshop.app.stringIDToTypeID( "countAdd" );
    private const COPY_INT:int  = Photoshop.app.charIDToTypeID('copy');
    private function onCreationComplete():void
         model = AppModel.getInstance();
         CSXSInterface.instance.evalScript("PhotoshopRegisterEvent", COPY_INT + "," + COUNTER);
         ExternalInterface.addCallback("PhotoshopCallback" + CSXSInterface.getInstance().getExtensionId(), myPhotoshopCallback)
    private function myPhotoshopCallback(eventID:Number, descID:Number):void
         var desc:ActionDescriptor = new ActionDescriptor();    // these two lines are useless here
         desc.fromID(descID);                                   //
         switch (eventID)
              case COUNTER:
              trace("Counter fired")
              break;
           case COPY_INT:
              trace("Copy fired");
              break;    
    After some extra research, I've understood that the second parameter for the addCallback should be a string, and adding the "," made it. So more properly I've added a .toString()
    I still have to understand how to remove the listener. It's straightforward with PSHA with .removeEventListener(), but now with ExternalInterface?
    I've also searched for documentation about "PhotoshopRegisterEvent", but I couldn't find anything useful. Where does it comes from, it's kind of a standard function? How can I find whether other similar (and possibly useful) functions exist - perhaps a "PhotoshopUnRegisterEvent" ? :-)
    Too many questions...
    Regards
    Davide

  • CairngormCommand - EventHandler - ExternalInterface - HTMLPopup - window.opener == null !!!

    Hey,
    I stumbled over a strange behavior... First I thought it's the PopUpBlocker
    I successfully implemented the payPalFlex solution. Only difference is, that I need to create a OrderHeader Entity before calling the PayPal-PopUp Window.
    So if I cancel the PayPal process and want to make the callback via. JavaScript to Flex (it's the onCancel part...)  the window.opener is null?! So I am already searching about 5 hours to find out what happened there. I think it's because I am not running in the main thread anymore.
    (I already tried to implement this with a changeWatcher and the Cairngorm successHandler Pattern...)
    Do you have a clue what's the Problem?
    Thanks!!!!
    some code out of my cart:
    // this gets called from button "Pay with PayPal"
    private function doPayWithPayPal(event:Event):void {
            // first create the OrderHeader
         var orderHeader:EOrderHeader = new EOrderHeader();
         orderHeader.id = 0;                    
         orderHeader.orderNumber = 0;               
         orderHeader.customerID = 0;                
         orderHeader.giftCodeID = 0;
         orderHeader.shipmentTypeID = 0;
         orderHeader.fulfillmentFlag = 'F';
         orderHeader.dateOrderDate = new Date();          
         orderHeader.orderTotal = sumOrder;
            // dispatch event to create orderHeader on Server
         var orderHeaderEvent:OrderHeaderEvent = new OrderHeaderEvent(OrderHeaderEvent.SAVE_ORDER_HEADER);
         orderHeaderEvent.orderHeader = orderHeader;
            orderHeaderEvent.successHandler = orderHeaderSaved;
         orderHeaderEvent.dispatch();
    protected function orderHeaderSaved():void {
         if( AdminModel.getInstance().returnedOrderHeader == null ) {
              Alert.show("Error!!!");
         var orderID:Number = AdminModel.getInstance().returnedOrderHeader.id;
         var requestURL:String = "remote/payPalFlex/startPaymentFlex.php";
         ExternalInterface.call('window.open','about:blank',
              'myWindow','height=500,width=900,toolbar=no,scrollbars=yes' );
         var url:URLRequest = new URLRequest("remote/payPalFlex/startPaymentFlex.php");
         url.data = new URLVariables();
         var obj:URLVariables = new URLVariables();
         url.data.useAs = orderID;
         url.method = "GET";
         navigateToURL(url,"DomainStickersWindow");
    in cancle.php:
    <html>
    <head>
    <title>PayPal PHP API Response</title>
    <script type="text/javascript">
         function doCancel() {
              window.opener.window.document.getElementById('index').doCancel();
              window.close();
    </script>
    </head>
    <body>
      You canceled, close to go back to the shop blablabl...
    <a href="javascript:doCancel()">ZurŸck zum Shop</a>
    </body>
    </html>

    Not solved yet but it seems to be a Safari specific Problem.

Maybe you are looking for

  • Mini DisplayPort to VGA cable, when available?

    With this new MacBook aluminum, the I/Os are changed a little bit. The Mini DisplayPort in particular, it is said to be perfect to connect to Apple LED Cinema Display, but what if I want to connect any regular projector in order to do presentations?

  • File Adapter with Conversion - XML with Hierarchy?

    XI 3.0 (SP9) We are using the inbound file adapter with conversion to convert a flat file that has header and line items.  I would have thought that the data type should have been setup something like this: <data type> <header>   <item>1</item>   <it

  • How to add a drop-down menu to a rollover image?

    Hi, I guess my title says it all... I was wondering how to add a drop-down menu to a rollover image? I know that there's the sprymenu, but I need to have my own rollover images. Thanks, Kazem

  • Spanning columns in a grid messes up column widths

    Hi. I've been struggling with some layout issues when using column width percentages with the Flex Grid control. It seems that if I add a column that spans 2 or more columns, the column widths of the entire grid are altered. The strange thing is that

  • Problem using CFC as datasource

    Hi Hoping someone can help me with a pretty basic problem. I am trying to use a cfc as the datasource for a combobox and also for a tilelist but I have to say I think I am missing something obvious. The problem is that when using the code below for m