Access a component in an mxml file from a different mxml file

Hi,
I want to access a component in an mxml file 1 such as this one  <mx:Image id="img" width="101" height="200" source="{product.image}"/> using the
id
from the actionscript function from a different mxml file 2
public function init():void
       HERE.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );    
so i can make it dragable, Please help me  in this if u can urgently!!!!

okay,
I have the image component in ProductCatalogThumbnail.mxml, which has an id of "img"
so, i created a public variable in the file and a public function that returns the value of the object.
public var imagecopy:Object;
        [Bindable]
         public function imagecopyfunction():Object{
         imagecopy  = img;
         return imagecopy;
now, I want to access this image in the mxml file ProductList.mxml in a function
  public function init():void
      ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
     // accepting a drag/drop operation...
       this.area.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
       // handling the drop...
      //this.area.addEventListener( DragEvent.DRAG_DROP, handleDrop );
I tried to use the variable, and then i tried to use the function:
I got this error when I tried the variable : 1119: Access of possibly undefined property imagecopy through a reference with static type Class.
ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
and this error when i tried the function:  1061: Call to a possibly undefined method imagecopyfunction through a reference with static type Class.
ProductCatalogThumbnail.imagecopyfunction().addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
i made sure i imported ProductCatalogThumbnail file in the beginning of my application.
I am not sure what went wrong.

Similar Messages

  • DataGrid SelectedIndices from a different MXML component

    Hello
    I am refreshing a data grid that resides in my main component, from a sub-component. This works if I invoke the web service method to rebind the dataprovider, and I do not reference the datagrid directly from the sub component.
    My trouble is that I use checkboxes in my datagrid. I need to reset the selectIndices of the datagrid, but anytime I try to reference the datagrid directly it is NULL. The datagrid loses its checkbox selections every time I call the refresh, so I must explicitly reset the selectedIndices.
    How can I reset the datagrid's selectedIndices from a different MXML component? Why is my datagrid always NULL in my web service's result event handler?
    How can I directly reference my main component's datagrid, from my sub-component?

    Hi Devtron,
    You can figure this out by using events..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete();" xmlns:comp="comp.*">
    <mx:Script>
      <![CDATA[
       private function onCreationComplete():void
        comp2.addEventListener("refreshGridEvent",refreshGrid);
       private function refreshGrid(event:Event):void
        comp1.dataGrid.dataProvider = null;
      ]]>
    </mx:Script>
    <comp:Component1 id="comp1" />
    <comp:Component2 id="comp2" />
    </mx:Application>
    Now in your Component2 dispatch the refreshGridEvent event either on a button click or when your UI elements changes based on your requirement...this.dispatchEvent(new Event('refreshGridEvent')); and listen for the evet in manin mxml file and change the dataProvider of the dataGrid in Component1.
    Note: This solution is if your both components are placed in the main mxml file. Is your structure is same as I mentioned in the code above..I mean
    whether your two components are placed in the main mxml file.
    Thanks,
    Bhasker

  • How to retrieve elements from 3 different xml file in one url

    Hi all,
    Could anyone please let me how can we retrieve elements from 3 different xml file in one url?
    i just can only do it with one file only, any help would very appreciate.
    Thank in advance
    Jim

    Hi Philip
    Thanks for replying me.
    I tried on that way, In my mdx query i am using one slice attribute (i.e [Customer].[Gender].allmembers) in rows so getting error "The  Hierarchy already appears in Axis1".
    SELECT
    {[Measures].[Internet Sales Amount] } ON 0,
    NON EMPTY
    {[Customer].[Gender].allmembers } ON 1 -- Used
    FROM
    [Adventure Works]
    WHERE
    [Customer].[Gender].&[M]
    ,[Product].[Size Range].[(All)]
    ,[Customer].[Country].[All Customers]
    [Customer].[Gender].[All Customers]
    ,[Product].[Size Range].&[XL]
    ,[Customer].[Country].[All Customers]
    [Customer].[Gender].[All Customers]
    ,[Product].[Size Range].[(All)]
    ,[Customer].[Country].&[Australia]
    Can you provide alternate ways to get resolved.
    Thanks in advance

  • I am trying to open a .mxf files from 2 different Panasonic cameras in After effects CS3

    I am trying to open .mxf files from 2 different Panasonic cameras (the HVX 200A and the HPX 170) in Adobe After Effects CS3.  I have down loaded all of the Adobe CS3 upgrades and I have also installed the P2 card reader for Tiger which is the operating system on my mac.  I have not been able to open these files.  Can anyone help pls?

    >  I have not been able to open these files.
    Please tell us exactly what you're trying to do and exactly what happens. Make sure that you're following the instructions here.

  • I just purchased Acrobat Pro XI i downloaded the installation file from a different computer because mnes has no internet i click to setup/ install ot says "Acrovat instiller encountered an unexpected failure.  please try again. if continues contact dobe

    I just purchased Acrobat Pro XI i downloaded the installation file from a different computer because mnes has no internet i click to setup/ install ot says "Acrovat instiller encountered an unexpected failure.  please try again. if continues contact dobe support. " how can i install ot to my computer whats going on??

    I just purchased Acrobat Pro XI i downloaded the installation file from a different computer because mnes has no internet i click to setup/ install ot says "Acrovat instiller encountered an unexpected failure.  please try again. if continues contact dobe support. " how can i install ot to my computer whats going on??

  • HT1550 Exactly how does iTunes create an AIFF file from an Apple Lossless File?

    Exactly how does iTunes create an AIFF file from an Apple Lossless File?

    Paste the email address into any text field and drag it to the desktop.
    (52616)

  • Transfer excel files from iMac to excel file on ipad

    transfer excel files from iMac to excel file on iPad.  Using iTunes, I transfered files on my mac using Numbers and it worked fine, but trying the same method for an Excel file didn't work (i.e., the Excel file never showed up on my iPad.)
    Thanks for any help you can provide.
    LJ

    http://www.wondershare.com/pdf/transfer-pdf-to-ipad.html
    http://www.bythom.com/pdffaq.htm
    How to Transfer PDFs to an iPad
    http://www.dummies.com/how-to/content/how-to-transfer-pdfs-to-an-ipad.html
     Cheers, Tom

  • Accessing a variable in mxml file from an action script file

    Hi,
        I think this is a very very dumb question but i am nto being able to gigure this out i am a total newbie to flex.
         i have a mxml file e.g. aaa.mxml which has the following declaration
         ........ //some lines of code
         <mx:XMLListCollection  
    id="listCollectionData" source="{srv_new.lastResult.data.result}" />
      Now if i have some external file e.g. myActionScript.as - how do i access the listCollectionData value defined in aaa.mxml file?
    Thank you so much ...
    Rohit

    Hi,
             me not clear wether it is an AS file or AS Class
             if you are using ActionScript File then include your ASFile in aaa.mxml
                    <mx:Script  source="myActionScript.as" />
             If you are using ActionScript Class then create and object for aaa.mxml then you can use all the Properties of aaa.mxml in myActionScript.as

  • Download files from application server - unknown file name

    Hello everybody,
    I am working on a report allowing users to download XML files from the application server. All these XML files are created by the SAP system and their names can be found in a table. I can simply use OPEN DATASET for these files, put all file content to a buffer and send them to the GUI with CALL METHOD cl_gui_frontend_services=>gui_download.
    The problem is now that some files are touched by an external document management system. These files are moved to another directory and timestamped. The first is no problem since the folder name is always the same and can be replaced before the OPEN DATASET statement. But additionally, the file gets a timestamp, when the filename was xyz.xml before, it now gets xyz.xml.01012008123456123456. As I cannot try all possible values (mircoseconds!), I need a way to search for the right filename on the application server. Is there a function module for this available?
    It can always be stated that the former name (xyz.xml) is still a unique prefix, so I don't have to worry that xyz.xml.* will return multiple files.
    Thanks in advance for any suggestions.
    Christoph

    HI!
    I copy the function GET_DIRECTORY_FILE. In the eyelash of tables create one structures:
    DIR_FILES           LIKE                  ZDIR_FILES
    The single structure has component NAME (char 250).
    I code of the function that I use is:
    FUNCTION zget_directory_file.
    ""Interfase local
    *"  IMPORTING
    *"     REFERENCE(NAME_OF_DIR) TYPE  CHAR120
    *"     REFERENCE(NAME_OF_FILE) TYPE  CHAR120 OPTIONAL
    *"     REFERENCE(SP_CS) TYPE  CHAR120 OPTIONAL
    *"  TABLES
    *"      DIR_FILES STRUCTURE  ZDIR_FILES
      DATA: a_dir_name TYPE  char120,
            a_generic_name TYPE  char120,
            a_must_cs TYPE  char120.
      a_dir_name      = name_of_dir.
      a_generic_name  = name_of_file.
      a_must_cs       = sp_cs.
      DATA: errcnt(2) TYPE p VALUE 0.
      IF a_dir_name IS INITIAL.
       MESSAGE e220.     " 'Place cursor on valid line !'.
      ENDIF.
      CALL 'C_DIR_READ_FINISH'             " just to be sure
          ID 'ERRNO'  FIELD file_list-errno
          ID 'ERRMSG' FIELD file_list-errmsg.
      CALL 'C_DIR_READ_START' ID 'DIR'    FIELD a_dir_name
                              ID 'FILE'   FIELD a_generic_name
                              ID 'ERRNO'  FIELD file-errno
                              ID 'ERRMSG' FIELD file-errmsg.
      IF sy-subrc <> 0.
        sy-subrc = 4.
        EXIT.
      ENDIF.
      file-dirname = a_dir_name.
      DO.
        CLEAR file.
        file-name = '*.zip'.
        CALL 'C_DIR_READ_NEXT'
          ID 'TYPE'   FIELD file-type
          ID 'NAME'   FIELD file-name
          ID 'LEN'    FIELD file-len
          ID 'OWNER'  FIELD file-owner
          ID 'MTIME'  FIELD file-mtime
          ID 'MODE'   FIELD file-mode
          ID 'ERRNO'  FIELD file-errno
          ID 'ERRMSG' FIELD file-errmsg.
        file-dirname = a_dir_name.
        MOVE sy-subrc TO file-subrc.
        CASE sy-subrc.
          WHEN 0.
            CLEAR: file-errno, file-errmsg.
            CASE file-type(1).
              WHEN 'F'.                 " normal file.
                PERFORM filename_useable USING file-name file-useable.
              WHEN 'f'.                 " normal file.
                PERFORM filename_useable USING file-name file-useable.
              WHEN OTHERS.              " directory, device, fifo, socket,...
                MOVE sap_no  TO file-useable.
            ENDCASE.
            IF file-len = 0.
              MOVE sap_no TO file-useable.
            ENDIF.
          WHEN 1.                     " end of directory
            EXIT.
          WHEN 4.                     " filename too long
            MOVE sap_no TO file-useable.
          WHEN OTHERS.
            ADD 1 TO errcnt.
            IF errcnt > 90.
              EXIT.
            ENDIF.
            IF sy-subrc = 5.
              MOVE: '???' TO file-type,
                    '???' TO file-owner,
                    '???' TO file-mode.
            ELSE.
            ULINE.
            WRITE: / 'C_DIR_READ_NEXT', 'SUBRC', SY-SUBRC.
            ENDIF.
            MOVE sap_no TO file-useable.
        ENDCASE.
       PERFORM p6_to_date_time_tz(rstr0400) USING file-mtime
                                                  file-mod_time
                                                  file-mod_date.
      * Does the filename contains the requested pattern?
      * Then store it, else forget it.
       MOVE-CORRESPONDING file TO file_list.
       APPEND file_list.
        MOVE file-name TO dir_files-name.
        APPEND dir_files.
       IF a_must_cs = no_cs.
         MOVE-CORRESPONDING file TO file_list.
         APPEND file_list.
       ELSE.
         IF file-name CS a_must_cs.
           MOVE-CORRESPONDING file TO file_list.
           APPEND file_list.
         ENDIF.
       ENDIF.
      ENDDO.
    ENDFUNCTION.
    *&      Form  filename_useable
          text
         -->A_NAME     text
         -->A_USEABLE  text
    FORM filename_useable USING a_name a_useable.
    *--================--
      DATA l_name(75).
      l_name = a_name.
      IF l_name(4) = 'core'.
        a_useable = sap_no.
      ELSE.
        a_useable = sap_yes.
      ENDIF.
    ENDFORM.                    "FILENAME_USEABLE
    With this I obtain all the archives XML of that route in a table
    DATA: zfiles LIKE STANDARD TABLE OF zdir_files WITH HEADER LINE.
    CALL FUNCTION 'ZGET_DIRECTORY_FILE'
      EXPORTING
        name_of_dir = dsn
      TABLES
        dir_files   = zfiles.
    IF sy-subrc = 0.
      LOOP AT zfiles .
        IF  zfiles-name+0(2) = 'O_' AND
            zfiles-name+2(3) = sy-mandt AND
            zfiles-name+5(1) = '_' AND
           zfiles-name+22(4) = '.xml'.
          file = zfiles-name.
    endloop.
    endif.
    I hope this helps you.
    Regards.

  • Getting list of files from Unix directory inclding files frm sub-directries

    Hi All,
            I am trying to use Fm 'SUBST_GET_FILE_LIST'  and
    'RZL_READ_DIR_LOCAL' for getting a list of all files in a Unix directory including files from sub-directories.
    In the first case I am getting an Exception called 'Access Error'
    and when I use the 2nd FM, I am not getting any output.
    Is there a special way to use these FMs.
    Kindly help.
    Regds,
    Shweta

    [url http://java.sun.com/developer/JDCTechTips/2003/tt0122.html#1]READING FILES FROM JAVA ARCHIVES (JARS)

  • Using File Adapter to transfer files from directories on unix file server.

    I have this scenario. I have a PI server on hpus45 and I want to use it to transfer files from a source directory to a destination directory on a unix file server. The unix file server is on a different box eg hpus30.
    What do I configure in SLD and Integration Directory? All the examples I have seen is transfering files from directories on the PI server but none on a different box.'
    Is it possible? I need help asap. I need to determine what the best approach is by today.

    Hi Agasthuri Doss,
    I'm using PI 7.1. I'm not seeing your instructions in ID.
    The objects in PI 71. are in this order
    Unassigned Objects
    Party
    communication component
    communication channel
    receiver determination
    interface determination
    sender agreement
    receiver agreement
    direct connection
    integrated configurations
    configuration scenario
    value mapping group.

  • How to get file from FTP Server using File Control

    Hi,
    Any one did getting file from FTP Server?
    Please let me know any one help me.
    I would need to get file from FTP Server.
    Thanks,
    Madhu

    Yes I have done that. But In FTP Server I cannt read file, because no previliges. Only I need to copy file from FTP Server to local server then only I can read that file.
    I tried all options using FileConrol(getFiles(),read()).
    getFiles() - It wont copy the file, it give information about file.
    read() - I dont have previliges to read the file.
    Please tell me any other procedure would be there for getting file from FTPServer.
    Thanks,
    Madhu

  • Process TIFF file from FTP server using File/FTP adapter

    Hi,
    I have a requirement to process a scanned document TIFF file from a directory on an FTP server using the File/FTP adapter and process through XI into a Web Service via a receiver SOAP adapter.
    My question is can the file/FTP adapter be used to process the TIFF file into XI from an FTP server ? Also, what settings need to be made on the file adapter to allow this file to be processed into XI ?
    Thanks in advance
    Colin

    hi colin,
    TIFF is type of image file, it can be converted to binary using java mapping
    refer this pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
    regards
    Ramesh P

  • Getting file from directory where class files are

    hi i want to load a properties file from the directory where my java program is (the class/jar files)
    somebody told me that i could use System.getProperty("user.dir"); but it would only work under windows; under linux it points elsewhere.
    how can i determine the directory where my program lies? sounds easy but i failed :(

    why to hell put it in the classpath? Because that way you don't have to ask the user where the hell he put the file.
    and if i would do so the next question: how can my
    program modify the classpath?It can't. And it doesn't need to.
    isn't there another way to determine the directory
    where the app is started from???If you mean the current, or working, directory, then yes there are several ways to determine that. But that directory need not be where the classes are actually stored. In fact the current directory doesn't even have to be in the classpath.
    Now, here's the best way to deal with properties files. (IMHO of course.) Put them in the classpath, in the same directory or jar file as your classes. Then to create a Properties object and load it from your properties file named e.g. "default.properties" you do this:Properties props = new Properties();
    props.load(this.getClass().getResourceAsStream("/default.properties"));

  • Delete files from computer - not allowed, file in use

    Using firefox to upload files online, being this a simple pdf document or a video file, prevents me from deleting the file from my hard drive, once the process is completed. Once I quit the web browser, deleting the file is possible. It looks like firefox is keeping the link to a file in constant use even after the website at which the file was used is no longer opened. Am I missing some something in firefox's properties settings?

    I've called the big guys to help you. Good luck.

Maybe you are looking for

  • Switching from Mini to Nano

    Greetings, How tough is it to synch a new Nano from My Itunes account for my Mini? Do I need any 3rd party program to do so?

  • Podcast Playlist Problems - 1st gen Shuffle

    First off, I'm a casual user of iTunes & Shuffle - almost solely for podcasts and couldn't figure out how to make a playlist stick on the iPod; it would revert to file order, not playlist order. Couldn't reorder in the Library>Podcasts folder. Autofi

  • Issue while integrating  OID and BPEL.

    Issue while integrating OID and BPEL. We followed steps mentioned in for integration. WE have two SoA instances, home, oc4j_soa. http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28982/service_config.htm#BABIBGFF Before running configur

  • Action listener in different class

    Hi I now have a class called Gui and a class called Listener. The gui contains public class Gui implements ActionListener public void actionPerformed(ActionEvent e) { }the Listener contains public class Listener extends gui implements ActionListener

  • HT1229 how do you install older iPhoto suitable for Mavrick 10.9.5

    for MacBook Pro  OS 10.9.5 Mavrick - Problem, - I re-formatted the hard disk and reinstall the OS 10.9.5 Mavrick - for some reason the iphot either disappeared or did not appear on the system. Downloaded iPhoto from the App  library - The new downloa