I have a strange behavior for me as a newbie. I have an image which I drop
to a box. The image is accepted if only if the box is white. I cannot figure
it out the reason of this behavior.

The code,


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; height="641">
    <mx:Model id="modelo">
        <jugadores>
            <jugador>
                <nombre>Fernando</nombre>
                <posicion>16</posicion>
                <potencia>100%</potencia>
                <foto>imagenes/foto.jpg</foto>
            </jugador>
            <jugador>
                <nombre>Agustin</nombre>
                <posicion>10</posicion>
                <potencia>90%</potencia>
                <foto>imagenes/foto.jpg</foto>
            </jugador>
            <jugador>
                <nombre>Ezequiel</nombre>
                <posicion>1</posicion>
                <potencia>10%</potencia>
                <foto>imagenes/foto.jpg</foto>
            </jugador>
        </jugadores>
    </mx:Model>
    <mx:Script>
        <![CDATA[
            import mx.events.DragEvent;
            import mx.containers.Box;
            import mx.managers.DragManager;
            import mx.core.DragSource;

            public function mouseMove(event:MouseEvent):void{
                // Get the drag initiator component from the event object.
                var dragInitiator:Image = event.currentTarget as Image;

                // Create a DragSource object.
                var dragSource:DragSource = new DragSource();

                var dragProxy:Image = new Image();
                dragProxy.source = event.currentTarget.source;
                dragProxy.width=dragInitiator.width;
                dragProxy.height=dragInitiator.height;

                // Call the DragManager doDrag() method to start the drag.
                DragManager.doDrag(dragInitiator, dragSource, event,
dragProxy);
            }
            // Called if the user drags a drag proxy onto the drop target.
            private function dragEnterHandler(event:DragEvent):void
            {
                trace("entre");

                var dropTarget:Box=event.currentTarget as Box;
                DragManager.acceptDragDrop(dropTarget);
                trace("acepto: " + event.currentTarget);

            }

        ]]>
    </mx:Script>
    <mx:Box>
        <mx:Panel width="542" height="404" layout="absolute">
            <mx:Image id="sdf" x="0" y="0" width="407" height="364"
source="imagenes/partido.jpg" />
            <mx:Image id="asd" source="imagenes/foto.jpg" width="24"
height="28" x="290" y="104" mouseMove="mouseMove(event);" />
            <mx:Box backgroundColor="#FFFFFF" x="10" y="10" width="226"
height="344" id="canchaDelantera" dragEnter="dragEnterHandler(event);" />

        </mx:Panel>
    </mx:Box>
    <!--mx:VBox>
        <mx:Image source="imagenes/foto.JPG"/>
        <mx:Label text="nombre"/>
        <mx:Label text="posicion" />
        <mx:Label text="potencia" />
    </mx:VBox-->
<!-- perfil -->


</mx:Application>

Thanks in advance.

-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus
http://mientretiempo.blogspot.com/

Reply via email to