External JS from AIR with Flex?

Hi,
I wonder if this is possible. I have a AIR application built
using Flex, I would like to apply syntax highlight within the flex
application - but my actionscript experience is very limited.
My question:
I've used JavaScript syntax highlighting scripts before
(shjs) - I would like to use this package inside my Flex
application. Is this possible, can I load and use external
JavaScript files inside Flex/Air apps?
I see this can be done using Flex in a Browser (flex without
AIR) with the 'ExternalInterface API' - is this currently available
for AIR or is there any other method available to do this?
To me this is a huge factor for the success of Flex inside
AIR. I have a huge range of JavaScript libraries I've built over
the years, it would really suck if I had to rewrite everything in
ActionScript.
Any ideas??

Hi,
With AIR, you don't need to worry or think about
ExternalInterface. AIR comes in built with webkit. Just use the
mx:HTML control to load your html page containing the javascript
and you will be able to make JS calls from your Flex side.
But do note that there are limitations to what sort of JS can
be run within the HTML control. Especially around "eval". Take a
look at
http://livedocs.adobe.com/flex/3/html/help.html?content=security_4.html#1091782

Similar Messages

  • Webcam not working in AIR with Flex 4.0 SDK

    Hello everybody,
    I have created an AIR application with the Flex 4.0 SDK which tries to activate a webcam. When I run the application, the webcam signalizes that it has been successfuly activated but unfortunately I do not receive a camera image, nor do I receive an activation or error event from the camera. When I change the application type to "web", everything works just fine.
    According to this thread:http://forums.adobe.com/message/2580536 , you should activate the Flex 3 compatibility mode. Unfortunately, I rely heavily on Flex 4 components which cannot be changed or removed.
    Is there a way to activate the webcam under AIR with Flex 4?
    Best regards,
    Bernd

    I used ditto on Mac. I would make a backup copy of the Flex SDK first.
    Then use ditto to update the SDK with AIR SDK.
    -ted

  • Sending external email from SAP with following requirements...

    Hi All,
           I need to send external emails from SAP by meeting following requirements.
    1) With subject line more than 100 characters.
    2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
    3) Should be able to know the success/failure of mail sending at program level.

    Hi,
    The code below demonstrates how to send an email to an external email address
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_receivers
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • Air application loading flex applications(no Air) with flex linked as RSL.

    Hello
    I am trying to make an AIR application which loads number of flex applications(no AIR). The subapplications are using the Flex SDK as a RSL, and each of them can use different version of the SDK.
    The problem is that the subapplicationsare trying to load the needed SDK from local filesystem, which they are not permited.
    public class CrossDomainRSLItem extends RSLItem
         override public function load(progressHandler:Function,
                                      completeHandler:Function,
                                      ioErrorHandler:Function,
                                      securityErrorHandler:Function,
                                      rslErrorHandler:Function):void

    Hi again.
    Is there any way to reliably edit the trust files with AIR application?
    As I see it we have to make the user to add our folder to the trusted locations, or to use some application which can find and write in the FlashPlayerTrust (native for the specific OS installer for example.). (even finding this directory with an AIR application seems not 100% reliable).
    Thanks in advance for you help.
    Ps: Right now I am trying to patch this.
    I compiled some sub-applications using custom preloader class(the controlling class, not the UI), where I removed the RSL loading. After that in an ApplicationDomain I load all the RSLs with loaders. After that I load the sub-application in the same domain. On paper this should work, but the sub-application can't find the classes from the RSLs(the first exeption is that there is no definition for spark.components.Application)

  • Adobe air with flex, file new, open and save for Desktop software program

    I already have a headache from all the searching. I cannot believe this to be such a confusing topic as every software program we create must be able to save user input, right.
    Here is the problem:
    Novel writing software program Main window has tabnavigator with four navigatorcontent pages 1. characters, 2. worlds, 3. objects, 4. Editor
    Each navigatorcontent page has user input fields in the form of textinput component, textarea component, richtexteditor component, etc.
    problem 1:
    The user needs to be able to open a new project and give it a name and state where it must be saved. All user input in the Novel writing software program must be attached to the file name the user specified - cannot give sample code cause I don't even know where to start looking anymore.
    Problem 2:
    If the user has now defined a new project name, all his input from the different input components has to be compiled into a single file that can be saved. (Dan Pichelman gave me a satisfactory answer on using the file.borwseforsave funtion.) That makes sense, but I first need to get all the user input into that single file. I was convinced that it must be an xml file and that there would be a guide on how to do this but...
    Problem 3:
    This brings me to another problem. All the pages I've researched so  far tell me how to load data from an xml file into a component, but not how to write the text from the component into the xml file. And this xml file cannot be the prefs file in the storage directory, it has to be named by the user and then after filling in all his text in the different tabs of the software, must be saved in this xml file and saved where the user chooses.
    Problem 4:
    now that the user put in his text and it is written to an xml file that he has named and set the path to, he goes on vacation and in two weeks opens his saved file to work on his project again. All the data that was stored in the xml must now be written back into the different user input components so he can continue working on his project, truth be told, there are some samles and tutorials on this subject, but again from only a single page perspective not a multiple tab perspective.
    Problem 5:
    Now the user has deleted and/or changed some text he put in when he started, he wrote some more text in the textareas and texteditor and he clicks the file - save button. The xml file or whatever needs to be used must be updated and saved with all the changes overwriting the old file.
    Problem 6:
    The data entered by the user will end up being a book of say 400 pages. This data will obviously be mostly in the richtexteditor component, so whatever method of saving is used, database or xml or whatever, needs to be able to contain all this data.
    Thought, if you are working with for instance, microsoft powerpoint, it has multiple pages all containing different user inputs and when you click flie - save, it saves all that input into one file. When I as a user opens that saved file it loads all that content back into its place and I can change and manipulate the input and save it again. I would have thought this would be one of the first things adobe or any other software would teach as this is what sofware programs are all about. But alas, the tutorials on this subject for adobe air for Desktop application is extreeeeemely rare.
    My promise is, if someone can help me with this or there is a tutorial out there that covers this properly I  will write a tutorial on this for other newbies as I progress step by step.  
    Pleeeeeeease help this ignorant novice
    Regards

    to save a file you would do something like:
    FileWriter fw = new FileWriter( fileName );
    textComponent.write( fw );
    fw.close();See the JFileChoose API for filtering files by extension. The API gives an example.

  • Been trying to use an external memory card reader with my macbook air- connecting via usb port, air does not recognize device nor the microSD card from my gopro - help

    Been trying to use an external memory card reader with my macbook air… connecting via usb port, air does not recognize device nor the microSD card from my gopro … help

    Some external ones do not work with the Mac's although most do. There are some driver compadibility issues with Mavericks, so I would wait for an update.

  • [svn:fx-trunk] 5067: In preparation for adding ASDoc version tags for Flex, remove old tags from AIR files

    Revision: 5067
    Author: [email protected]
    Date: 2009-02-25 08:21:22 -0800 (Wed, 25 Feb 2009)
    Log Message:
    In preparation for adding ASDoc version tags for Flex, remove old tags from AIR files
    QE Notes: None
    Doc Notes: None
    Bugs: -
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemComboBox.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemDataGrid.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemEnumerationMode .as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemHistoryButton.a s
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemList.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemSizeDisplayMode .as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FileSystemTree.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/HTML.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/FlexHTMLLoader.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/IWindow.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/Window.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/WindowedApplication.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/windowClasses/StatusBar.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/windowClasses/TitleBar.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/AIREvent.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FileEvent.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FlexNativeMenuEvent.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/FlexNativeWindowBoundsEvent .as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/WindowExistenceEvent.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/NativeDragManagerImpl.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/ApplicationTitleBarBack groundSkin.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/StatusBarBackgroundSkin .as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowBackground.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowCloseButtonSkin.a s
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowMaximizeButtonSki n.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowMinimizeButtonSki n.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/WindowRestoreButtonSkin .as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/utils/DirectoryEnumeration.as
    flex/sdk/trunk/frameworks/projects/airframework/src/mx/utils/DirectoryEnumerationMode.as

    I'm also having this problem. I'm using Flash Builder 4.6, AIR 3.4 and I've made a DLL (e.g. ExtensionDll.dll) which needs to call functions in another DLL (e.g. DllUsedByExtensionDll.dll) . I've made sure my ANE is working with the ExtensionDll.dll already, so there are no issues with my actionscript code or my ANE packaging or my DLL compilation. However, once I start calling functions from the other DLL, it starts throwing me Error #3500. Even if I call this function (e.g. abc()) in ExtensionDll.dll, but I never actually use the function from actionscript, and I call another function (e.g. def()) from actionscript, the Error #3500 still appears, so it does not seem to depened on the whether the code is used or not.
    It's similar to this problem.
    http://stackoverflow.com/questions/9823504/how-to-use-external-dll-in-air-native-extension
    Does anyone have a solution or at least a way to debug this?

  • I recently purchase macbook air with OS 10.10.2. I want to use my Seagate external backup plus hard drive for time machine back up. How to partition my 1TB Seagate back up plus hard drive for use with mac and windows pc?

    Hi All,
    I recently purchased 13" Macbook Air with OS 10.10.2. I want to use my 1TB Seagate backup plus external hard drive as time machine and my windows 7 pc. Please suggest a method. Thanks in advance for your reply.

    I strongly recommend having an external drive dedicated solely for TimeMachine. You could partition the drive but if something goes wrong you risk losing the data on both partitions. Should you decide to go ahead with splitting the drive for two different uses you’ll need to partition the drive either using the Mac’s built in Disk Utility program or Windows utility. I believe the built in Windows disk utility program will destroy the current partition and erase the data that’s on it - I use a third party Windows disk utility program for partitioning and it allows for non-destructive partitioning but warns to back up data first just in case. Apple’s Disk Utility can do non-destructive partitions but I don’t recall every trying to do a non-destructive partition on a disk originally formatted for Windows using it. Again - back up that data just in case.
    Finally, your TimeMachine drive should be at least 1.5 times (I prefer 2 times) the size of the data you expect to be backing up a year or two from now.  In other words, if you currently are using 50GB of your computer’s drive but expect to begin purchasing Mac software to replace software on your Windows computer and if you expect to be putting photos, music, and other data on it you might expect that two years from now you’ll have 100GB of stuff on the drive. So a 200GB partition is the smallest size you’d want.  TM’s backup scheme keeps multiple copies of data as it changes so the extra room is important for this scheme.

  • Just bought a mac air with OS X v.10.7 Lion, for work I need to read and write NTFS drives, I install MacFuse and NTFS-3G, but it can not mount (recognize?) External HDD, in my MBP with Snow Lepard it work just perfectly... help please.

    Just bought a mac air with OS X v.10.7 Lion, for work I need to read and write NTFS drives, I install MacFuse and NTFS-3G, but it can not mount (recognize?) External HDD, in my MBP with Snow lepard it work just perfectly... help please.

    Reinstall MacFuse with the one from http://www.tuxera.com/mac/macfuse-core-10.5-2.1.9.dmg. If that doesn't work, you can use Paragon NTFS for Mac 9.0 which has been designed to work with Lion.

  • Connecting AIR with external database

    Is it possible to connect AIR application to the external database in MySQL technology?

    Are you trying to connect to a MySQL database on a web server somewhere? If so, by far the easiest way to do so is to use some sort of application server layer (e.g. PHP, ColdFusion, Java) on the web server, and have the AIR application call the PHP (or whatever) code to get the data. That is the approach that all the links Greg has given you are talking about.
    Of course, in order to make that work you need to know enough PHP/Java/ColdFusion to write that middle layer. In the example you're asking about, the information it wants to know is the name of the server that the MySQL database is running on, and the MySQL username and password for the MySQL account that your PHP code is supposed to use. There are tons of resources on the web for writing PHP code that accesses MySQL, so you'll find much more and better information in other places than what you'll find in the Adobe AIR forums.
    However, maybe you want to have the MySQL server running directly on the user's computer rather than on a web server somewhere. In that case you would have a few options:
    Run a web server and application server (e.g. Apache and PHP) on the user's computer and use those to connect between the AIR application and the MySQL server.
    Write Java code to communicate between the MySQL server and the AIR app, and call that code using Merapi (http://merapiproject.net/)
    Run the MySQL server on the user's computer and call the server directly from AIR using ActionScript. While there is no built-in support for MySQL in AIR, there is a third-party (open source) library for calling MySQL directly from ActionScript available here: http://code.google.com/p/assql/. I haven't tested it so I have no idea how complete it is, but it's a solution to consider.
    However, in all three cases you're depending on some external pieces that have to be installed and loaded separate from your AIR application. (For instance, most users probably don't want a MySQL server running on their computer all the time if they aren't using your AIR app all the time -- so you'd want a way to start and stop the server, which also couldn't be done directly in AIR.) People do write applications that use external resources like this, but it's not the easiest thing to implement.
    If you're really wanting to run the database locally, the best solution (assuming it works for your needs) is to use AIR's built in local SQL database engine (based on SQLite). If you've looked at that option already, and found that it doesn't work for you, I'd be interested to know more about what you're trying to accomplish that you can't accomplish with the AIR local database.

  • Duplicate session error using Flash Remoting from Air 3.4 Mobile Apps ( IOS and Android ) with CF10

    We're getting the "duplicate session" error using Flash Remoting from Air 3.4 Mobile Apps ( IOS and Android ) with Coldfusion 10 Standard.
    faultCode:Server.Processing.DuplicateSessionDetected faultString:'Detected duplicate HTTP-based FlexSessions,
    generally due to the remote host disabling session cookies.
    Session cookies must be enabled to manage the client connection correctly.' faultDetail:'null'
    Have read most of the docs about this error -all to do with LCDS
    Notes:
    Not using LCDS,
    No Remote Calls from loaded Sub-Apps,
    No Errors from the Flex Web App which is pretty  much identical and calls the same cfcs.
    The error does not happen all the time and is hard to reproduce - say 5% of app sessions at a guess.
    Could it be a two first time remote calls hitting the server together before a session is set up?
    Our remoteObjects are in two places 1) Main Application.mxml and within a class compiled into the main app - can't see how this would be an issue.
    I enabled session management for the CFCs in Application.cfc but still occurs. Is this neccessary - it's not in any docs?
    Could this be something to do with the app not being shut down - as is typical with mobile users? When they resume use after a day or two surely a new session will be created?
    Please advise thank you.

    For our profect I think this issue was caused as follows:
    Believing that remoting was full asynchronous we fired a 2 or 3 remote calls to the server at the same time ( within the same function ) - usually when the users goes to a new section of the app.
    This seemed to trigger the duplicate http session error since according to http://blogs.adobe.com/lin/2011/05/duplication-session-error.html  two remote calls arriving before a session is created will cause 2 sessions to be created.
    Our current solution ( too early to say it works ) is to daisy chain the multiple calls together .
    Also there seemed to be an issue where mobile apps that never quit ( thanks Apple! )  caused the error when activated after a few hours.
    I guess the session expires on the server and the error above occurs on activation.
    So the mobile apps now ping the server with a remote call when activated after sleeping for more than one hour.
    All duplicate http errors are silently caught and reported.
    Fingers crossed we won't get any more!

  • Virtual Desktop / Virtual OS with Flex / Air.

    I saw applications like: http://icloud.com and http://www.eyeos.com and they seem to work great in a browser, I think this should be created with Flex. and who knows the same app ported with AIR to run from the Desktop. Eventually this application can be make bootable and work as a real OS or some kind of virtualilzed client from a web browser.
    Can't wait to see Adobe taking this to the next level, imagine all the power of you OS in a Browser window, using resources of a Cloud Computing, or maybe just using resources from your Linux Host for small offices. Maybe booting with a Linux and use all the desktop as Flex/Air Desktop, that would be really awesome !!!.
    Dinooz

    The eyeos demo is down.
    But, from what I saw at iCloud, there is no reason you can't build an interface like that in Adobe Flex.  A few people have asked me for a "Flextras Desktop" which includes thing like a task bar component, a window manager /MDI, a start menu, etc...
    If you're looking for the same sort of thing, I'd love to talk to you more in depth about what you would use it for and specific features that you'd need: http://www.flextras.com/?event=ContactForm

  • Can you sync ibooks from an iMac to MacBook Air with the same apple id?

    Can you sync ibooks from an iMac to a macbook air with the same apple id?  Settings set to allow this.

    If the ibooks were purchased from Apple, and download new purchases is selected in iBooks preferences, then yes.

  • AIR application with Flex 4.5 will not render content. What gives?

    OK,
    So I've upgraded to Flash Builder 4.5 Premium and I am unable to develop desktop AIR applications with the 4.5 Flex SDK. I start by simply creating a brand new AIR application using the default SDK (Flex 4.5). I set the title property on WindowedApplication and include a simple Label component. The project compiles fine but when I run the application all I see is the adl window in the dock but that's it. If I modify the Main-app.xml file to set the visible attribute to true, I will get a small window but there is no content although the output window shows the application swf being loaded. Checking the release version of the Main-app.xml file shows the correct path location to the swf.
    Here is what I've tried so far:
    Install/reinstall Flash Builder, 4+ times
    Downloaded the trial installation twice
    Downloaded the SDK's for 3.6, 4.1 and 4.5.0. I then copied each SDK folder and merged the AIR 2.6 SDK with each copy. So now I have 6 SDK versions; one pristine and the other with the AIR 2.6 SDK merged. I then added each SDK individually and created an AIR desktop application for each. Each and every one works fine with the exception of the two 4.5 SDK's. They will not render content.
    I created a simple creation complete handler for the application that declares a simple variable and assigns a value to it. I then put a break point on the assignment and it never gets caught. More evidence that the swf isn't getting loaded.
    The computer I'm running on is a Mac Book Pro with Snow Leopard 10.6.7. If I create a web project in each of the 6 SDK's, those will work just fine. What the heck is it with Flex 4.5 and the AIR 2.6 SDK on this machine? I have the AIR 2.6 runtime installed as well as a number of AIR applications that work just fine. I also tried my 4.5 test on my windows machine and that worked like a champ.
    I am completely out of ideas. Finding information has been difficult because everyone is all about mobile so searching for desktop issues is a losing battle. I realize this is a long email but I'm desperate for help. There must be someone out there that knows more about the low level interaction between Flex 4.5/AIR 2.6 and the OS.

    Well, I finally found the issue, a corrupted mm.cfg file in /Library/Application Support/Macromedia. I deleted the file and then adl ran just fine.

Maybe you are looking for