Skip navigation
PhotoSì
Currently Being Moderated

Type coertion DragEvent issue

Jan 10, 2012 6:45 AM

We are developing a new plugin for Photoshop, and we use the <mx:Window....> class to open a new modal window.
Using this approach we always get problems when we try to use DragNDrop event on components like HorizontalList.

Actually the main problem is concerning different version of the class DragEvent:

 

TypeError: Error #1034: Type Coercion failed: cannot convert mx.events::DragEvent@15fe9581 to mx.events.DragEvent.
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.4.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9408]
    at mx.managers::NativeDragManagerImpl/_dispatchDragEvent()[C:\autobuild\galaga\frameworks\projects\airframework\src\mx\managers\NativeDragManagerImpl.as:625]
    at mx.managers::NativeDragManagerImpl/nativeDragEventHandler()[C:\autobuild\galaga\frameworks\projects\airframework\src\mx\managers\NativeDragManagerImpl.as:598]

 

Now we have found a solution using compiler option:

 

-includes=mx.managers.systemClasses.MarshallingSupport

 

but we use CS Extension Builder based on Flex SDK 3.4 so it's not possible to use that option.

Do you have any advise to fix that problem?

Thanks

 

Marco

 
Replies
  • Currently Being Moderated
    Jan 10, 2012 7:51 AM   in reply to PhotoSì

    Don't use the debugger...

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 10, 2012 8:31 AM   in reply to PhotoSì

    I assume you're dragging to and from Photoshop from your panel?

     

    I have an extension that does that successfully using Flex 3.4, listening for NativeDragEvent. It's not part of a mx:Window component...

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 29, 2012 1:04 AM   in reply to PhotoSì

    hi  PhotoSi,

    How you calculate drop position?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 29, 2012 2:04 AM   in reply to PhotoSì

    how you got the item from list through nativeEvent?Actually i have used AdvancedDataGrid and i want drop position or item at drop position?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 7:42 AM   in reply to PhotoSì

    *** Security Sandbox Violation ***

    SecurityDomain 'http://portip:8080/MyProject//servlet/ThumbDownloadServlet?fileName=17 9924 copy.tif&sessionId=NrzEsU-sPKY2ABZCGQ03CQ__.node1&assetId=385344&type =thumb' tried to access incompatible context 'app:/StageManager-2.5.swf'

    path:http://portip:8080/MyProject//servlet/ThumbDownloadServlet?fileName=AD _demo_images.jpg&sessionId=NrzEsU-sPKY2ABZCGQ03CQ__.node1&assetId=5056 78&type=thumb

    TypeError: Error #1034: Type Coercion failed: cannot convert mx.events::DragEvent@1a4776d1 to mx.events.DragEvent.

        at flash.events::EventDispatcher/dispatchEventFunction()

        at flash.events::EventDispatcher/dispatchEvent()

        at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.4.0\frameworks\pr ojects\framework\src\mx\core\UIComponent.as:9408]

        at mx.managers::NativeDragManagerImpl/_dispatchDragEvent()[C:\autobuild\ galaga\frameworks\projects\airframework\src\mx\managers\NativeDragMana gerImpl.as:625]

        at mx.managers::NativeDragManagerImpl/nativeDragEventHandler()[C:\autobu ild\galaga\frameworks\projects\airframework\src\mx\managers\NativeDrag ManagerImpl.as:598]

    TypeError: Error #1034: Type Coercion failed: cannot convert mx.events::DragEvent@1a477661 to mx.events.DragEvent.

     

    Hi , i am even facing same problem, time being i manged with: myList.addEventListener(NativeDragEvent.NATIVE_DRAG_COMPLETE,onDragCom plete);

          But am looking for some parmanet solution for doDrop , some one help me understanding why this  :myList.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP,onDrop); is not firing ..

     

    public function imageDrop( event: NativeDragEvent ): void {           

     

                trace( "Drop image target is: " + event.currentTarget.toString() );

                if ( event.clipboard.hasFormat( ClipboardFormats.FILE_LIST_FORMAT )||

                    event.clipboard.hasFormat(ClipboardFormats.TEXT_FORMAT) ||

                    event.clipboard.hasFormat(ClipboardFormats.URL_FORMAT)) {

                    var fileList: Array = event.clipboard.getData( ClipboardFormats.FILE_LIST_FORMAT ) as Array;

                    trace( "File List: " + fileList.toString() );

                    if ( fileList.length > 0 ) {

                        var f: DragFile = new DragFile( fileList[ 0 ] as flash.filesystem.File );

                        if ( "jpgjpegpnggif".indexOf( f.extension.toLowerCase() ) > -1 ) {

                            trace( "Loading file: " + f.nativePath );

                            loadFile( f );                       

                            return;

                        }

                        trace( "file is not an image" );

                    } else {

                        trace ( "fileList is empty" );

                    }

                }

                if ( event.clipboard.hasFormat( ClipboardFormats.BITMAP_FORMAT ) ) {

                    trace( "Dropping the bitmap" );

                    var bitmapData: BitmapData = event.clipboard.getData( ClipboardFormats.BITMAP_FORMAT ) as BitmapData;

                    var bitMap: Bitmap = new Bitmap( bitmapData );

                    model.imageCollection.addItem( bitMap );

                    model.selectedIndex = model.imageCollection.length - 1;

                }           

            }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points