Friday, December 15, 2006

Drag Drop from a Pop-up(Library Module)

Hi folks,
The entire last week i was struggling with the Drag Drop functionality for one of our module..So i wanna post this example for other ppl..I have seen lotsa queries on the same.So here is the example which i had created along with one of my team member.

Library.mxml
------------
<%

%>

import mx.core.IFlexDisplayObject;
import mx.controls.Alert;
import mx.containers.Canvas;
import mx.managers.PopUpManager;
import mx.events.DragEvent;
import mx.managers.DragManager;
import mx.core.DragSource;
import mx.containers.Canvas;
import mx.controls.Image;

public var dragInitiator:Image;
public var ds:DragSource;
public var dragProxy:Image;

public var libPop:*;
public var canTarget:Canvas;
public var imgTarget:Image;

public function openLibrary():void
{
libPop = PopUpManager.createPopUp( this ,CustLib, false );
}

public function dragEnterHandler(event:DragEvent):void
{
DragManager.showFeedback(DragManager.COPY);
canTarget = Canvas(event.currentTarget);
DragManager.acceptDragDrop(canTarget);
}

public function dragDropHandler(event:DragEvent):void
{
var dropTarget:Canvas = Canvas(event.currentTarget);
var imageProxy:Image = new Image();
imageProxy.source = libPop.ImageSelection.dataProvider[libPop.ImageSelection.selectedIndex].icon;

imageProxy.height = dropTarget.height/2;
imageProxy.width = dropTarget.width/2;
imageProxy.x = dropTarget.mouseX-75;
imageProxy.y = dropTarget.mouseY-75;

dropTarget.addChild(imageProxy);
}

public function displayChildren():void
{
Alert.show("Canvas Children-> "+myCan.numChildren.toString() + "\n" + "Pop Children->"+libPop.numChildren.toString());
}

]]>

dragEnter="dragEnterHandler(event);"
dragDrop="dragDropHandler(event);"
backgroundColor="#ffffff"
backgroundAlpha="1.0"
>







CustLib.mxml
-------------



x="{mx.core.Application.application.myCan.x + mx.core.Application.application.myCan.width}"
y="{mx.core.Application.application.myCan.y}"
>

import mx.events.DragEvent;
import mx.collections.*;
import mx.managers.DragManager;
import mx.controls.Alert;
import mx.controls.Image;
import mx.containers.Canvas;


[Bindable]
[Embed(source="assets/AAH.jpg")]
public var phone1:Class;

[Bindable]
[Embed(source="assets/AAV.JPG")]
public var phone2:Class;

[Bindable]
[Embed(source="assets/BLUESUN.JPG")]
public var phone3:Class;

[Bindable]
[Embed(source="assets/10c.png")]
public var phone4:Class;

[Bindable]
[Embed(source="assets/EYE.JPG")]
public var phone5:Class;


private function doDragEnter(event:DragEvent):void
{
var dropTarget:Canvas=Canvas(event.currentTarget);
DragManager.acceptDragDrop(dropTarget);
}

private function doDragDrop(event:DragEvent):void
{
var dropTarget:Canvas=Canvas(event.currentTarget);
var imageProxy:Image = new Image();
imageProxy.source = Image(event.dragSource.dataForFormat('images')).source;

imageProxy.height = dropTarget.height/2;
imageProxy.width = dropTarget.width/2;
imageProxy.x = dropTarget.mouseX-75;
imageProxy.y = dropTarget.mouseY-75;


}



paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10" layout="absolute">
maxColumns="1" rowHeight="125" columnWidth="125" dragEnabled="true" >













Tuesday, December 12, 2006

Flex Archive

Long time i havent posted anything.I m really occupied these days.Lotsa Actionscripting,Flashing,Flexing et al.I am bit occupied these days.Now i am working on Flex with Magnet Technologies Pvt Ltd. I m really thankful to Nirav Mehta and the entire Magnet team for allowing me to show my skills in Flex and Flash.There is lot to learn in Flex/Flash AS3.So trying to get hands on those things.Last week i was having a conversation with my TL and i came up with this idea of archiving whatever we create in Flex.So we decided to address a blog only for our newly created components and scripts and archive all those things at one place.In case if you require anything you can make a request.I will try to make it one for you.But to be honest i m still learning AS 3 so i m not sure that whatever i create will be flawless.And its been only 8 months that I am working on it.I know i have to go a long way.But we guys at Magnet have decided to put our asses on fire and work on these kinda things.So anybody out there wanna contribute to this archive are equally welcomed.Keep Actionscripting !!

Thursday, November 09, 2006

Flex Search Engine

Hello everybody,
welcome to my blog..I am workin on flex for the past 6 months only.. (today's date: 9/11/2006). I want to learn all the things in flex including flex data services, flex charting etc etc..
I will keep posting about any news from the flex side..And yeah thanks Ted for the component you had provided to everybody..Even i want to interact with other flex developers and also wants to help them and me..So thanks again..
All the best ..Keep Flexin !!!!!!! ;)

PS : Below is the link for the onflex.org...This site has some very good examples/tutorials with it..And there are lotsa ppl who were into Flex team who can help out in case of your queries..

Flex.org - The Directory for Flex

Sunday, October 08, 2006

Flash Player 9 with Full screen support

Hey this is real good news that Adobe is enhancing the feature of Flash Player 9 updated with the full screen support.Now we can watch videos in full screen.You can download this update from here.This release includes a new feature to enable full screen mode in the web player, bug fixes and support for additional operating systems — specifically Microsoft® Windows® Vista™.Isnt this is cool enough that they are projecting their design for Windows Vista also.To use this feature there are some guidelines to be followed..You can get the entire details from here.The release notes you can it from here.
I will keep you guys updated on this...