Dragging Components In Flex?

Apr 3, 2010

so I am trying to drag around some images in a canvas. I am adding eventlisteners to the components and calling startDrag() and stopDrag() to pick them up and stuff:

component.addEventListener(MouseEvent.MOUSE_DOWN, component.startDrag)

The problem is that it is selecting the image at its (0,0) location and not where I initially click on it. So there's a sudden "jump" when I click on the image. It is not smooth.

I noticed that startDrag() has two default parameters, one of them is lockCenter and it is default to false. Maybe do I set it equal to true somehow? (I don't know how to pass arguments to my second parameter in addeventlistener)

Another question: if I want to add more conditions to it, like make a new function that uses component.startDrag(), how do I pass the component to this function while adding event listener to it at the same time? for example: I want to do:

component.addEventListener(MouseEvent.MOUSE_DOWN, some_other_function);

where some_other_function uses component.startDrag();

View 2 Replies


Similar Posts:


Flex :: Components - Components - Any Component With The Functionality Such As Horizontally Collapsible Window Or Panel

Aug 22, 2010

Do you know any flex component with the functionality such as horizontally collapsible window or panel I found arc90, but it folds vertically.

View 1 Replies

Flash :: Flex Dynamically Created Components Added To Custom Components

Sep 8, 2009

I am created a dynamically adding a VBox, that contains two images. Into a Custom Component that is derived from UIComponent. The problem is the Vbox that contains the two image is only a really tiny size. I would like the VBox stretch to the size of the two images. This is how I am creating the Vbox....

[Code]...

View 1 Replies

Is It Bad Design To Nest Components Inside Components Using Flex 4

Sep 15, 2010

Is it bad practice/design to nest components inside components using Flex 4? Should I simply be creating components and inserting them into my main application as below, or doesn't it matter?

<com:MyComp1>
<com:MyComp2>
<com:MyComp3>

[code]....

View 1 Replies

Flex :: Dragging A Image Within A Loader?

Mar 23, 2010

I am having trouble in dragging a image within a loader. I am able to do zooming and rotating image but not moving image with mouse. Purpose is when I zoom a image info is out of boundaries and so is hidden. To see that info users should be able to drag the image any way they want.

View 1 Replies

Flex :: Prevent In Drag And Drop, Dragging Onto Self?

Oct 19, 2009

I was wondering, if I have two list boxes, and I want to drag and drop between both of them, how do I prevent the user from dragging onto the same list (thus duplicating the item? I cannot have a situation where that is the case

View 5 Replies

Flex :: Approaches / Libraries For Resize Dragging?

Jan 8, 2010

I'm currently working on a WYSISYG editor that allows the user to move, resize and rotate shapes by directly manipulating them. The resizing seems to be fairly complex when the shape is rotated. I got this working for non-rotated shapes, but it will take some trigonometric calculations to resize shapes that are rotated. The registration point is always is the middle of the rectangle because this makes rotating a lot easier. Before I start implementing this, I was wondering if anyone knew of any libraries or sample source code that does this, or could share some tips and tricks to calculate the transformations.

[Code]...

I attached a screenshot of what I'm trying to accomplish and another one that has some lines drawn onto it that should allow me to deduct the trigonometric calculations. The cross is the cursor.

View 3 Replies

Flex :: HSlider Dragging Using Slider Track?

Jan 15, 2010

I am trying to create a simple Music player has play/pause button and an HSlider that shows the position of the song as it is playing using a custom SliderThumbClass. I would like allow the user to drag/drop the sliderthumb or click on the sliderbar to change the position of the song currently playing.

With the code I have below, if I use the sliderThumb to change the position of the currently playing song, it works great. But I if I click directly on the slidertrack to jump ahead/back, the current position doesnt move and there is some flashing of the current position, but it jumps back to where it was and continues playing the song. This does work if I am in the paused state.

As expected, thumbDrag/Press/Release events are not triggered when the user clicks on the sliderTrack - What events should I be subscribing for to handle this case?

<mx:Canvas>
<mx:Script>
<![CDATA[

[code]....

View 1 Replies

Flex :: Spark TitleWindow Bad Redraw On Dragging?

May 11, 2010

I have a problem with redrawing in flex 4. I have a spark titleWindow, and if i drag it faster, it looks like it's mask is one frame late after the component. it's easily visible with 1pixel thin border, because it becomes invisible even with slower movement.

You can try it here (what is not my page, but it's easier to show you here than uploading example):[URL]..

If you move in direction up, you see disappearing top border. in another directions it's not that sensitive as it has wide shadow, and it's not very visible on shadow. On my computer i see it on every spark TitleWindow i have found on google, although it's much less visible with less contrast skins, without borders or with shadows.

View 2 Replies

Flex :: Draggable Scrolling. How To Scroll While Dragging

Sep 6, 2010

When I was starting to drag any element, mouse wheel scrolling is turned off, how to scroll while dragging?I'm newbie here, so I can't insert a picture, here's a link

View 1 Replies

Flex :: FSprites Don't Stop Dragging On MOUSE-UP

Feb 28, 2011

I have Sprites that I want to have move around when I click and hold them and stop when I release them. I have methods that add Event listeners to the Sprites:[code]My problem is: when I click on the Sprites, as soon as I move the cursor, the Sprite's registration point snaps to the cursor, and when I release the mouse the Sprite doesn't stop following the cursor. I initially thought it was a problem with pixel collision. I thought the cursor wasn't touching anything on MOUSE_UP, but that proved to be false after I experimented. I even replicated the exact same Event adding and handling methods by starting another project and found that I wasn't having this problem. The test Sprite was simply dragging and dropping like usual, not snapping to the registration point, and being dragged by the point I clicked.

The only difference I can see, and also my only suspicion, is that the Sprites in my original code are being added to a Sprite, which is then being added to the stage, whereas the Sprite in the test project is being added to the root DisplayObject. I'm thinking that somehow the Event propagating down to the container Sprite and dragging and dropping that without dropping the other Sprite. The weird snapping I'm seeing might be the cursor snapping to the object behind the other sprite. Another important thing: when I drop a Sprite on top of another Sprite, that Sprite stops moving like I want it to, but still trails the registration point.

View 1 Replies

Flex :: Disable Dragging Of Alert Windows?

Mar 10, 2011

How can I disable dragging of the Alert window in Flex? I don't want the users to move my alert windows. What shall I do?

var a:Alert=new Alert();
a.text="Alert Message";
PopUpManager.addPopUp(a,this,true);

View 3 Replies

Flex :: Dragging The AIR Application Window Around The Screen?

Jul 31, 2011

I have an AIR application. It should be moved around the screen with the mouse. In order to achieve this I use the event: this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, true,-2);

It should be activated with the lowest priority compared to inserted elements for example those that should be scrolled, clicked, etc. I tried the solution shown below with the event priority set to -1 because there might happen 2 different events and my moving application event should be the last one to be serviced or shouldn't be serviced at all.

[Code]...

View 1 Replies

Flex :: Drag And Drop - Prevent Dragging For Certain Items?

Mar 22, 2010

how would you prevent dragging for some items of your List or DataGrid?

Let's say I had a list with two items: 'Tom' and 'Jerry'. Only 'Tom' should be dragable, not 'Jerry'.

Ideally I had a 'isDragEnabled(item:Object):Boolean' function, which is being queried by the drag source.

My difficulties start with the fact that the 'dragStart' event handler has a null value for the dragSource, so right from the start I find it hard to find out what the drag-start is about..

PS There have been a few discussions on preventing or canceling a drop, but I haven't seen much about preventing the drag start, hence this question.

View 3 Replies

Flex :: Prevent Dragging Outside The Parent Container In Flash?

Nov 22, 2010

I have a canvas onto which I draw shapes like rectangle etc. When I move the shape using my custom mouse down/mouse move handler, the shape can go outside the parent bounds.

I am checking if the child is outside the parent's bound to snap it back:

var bounds:Rectangle = this.getBounds(this.parent);
var p:Point;
if (bounds.x <0) {

[Code]...

The snapInside method gets called when I go outside the left or top boundary. But when the child is dragged outside the right or bottom boundary, I find Flex/Flash runtime automatically expands the parent's height and width. So say the parent size was initially 800x600, if child Y bounds exceed 800 by say 20 pixel, I find the this.parent.height automatically resized by flex to 820!!

How do I prevent the parent from resizing when child goes outside the original bounds of the parent ?

View 1 Replies

Flex :: Drag - Dragging Image Horizontally With Collision

Mar 3, 2011

How can I constrain an image in a container to only a horizontal drag that when it collides with another image 'pushes' that image along that same horizontal line.

View 1 Replies

Flex :: Stretch An Image By Dragging Its Sides In Adobe?

Mar 22, 2012

I want to develop a hair style app in adobe flex. In that ,the wigs should be placed in right position.So i want to adjust the wigs in x and y directions.

how to stretch an image in x and y direction?[url]...

View 3 Replies

Flex :: Example Flex Zend AMF Sharing Web Services Between Components In ViewStack

Aug 10, 2011

I've been searching for the last couple days but can't seem to find a basic example of what I'm looking for. I'm developing a Flex 4.5 app and in it I have a viewstack of 2 components that use some of the same services. Currently the only way I can get the app to correctly use the web services is by defining 2 different web services that use the same PHP web service file. For example: I have an app, and within it I have a viewstack with tab navigation of 2 components: #1) retrieve a list of all Salary Employees, and #2) retrieve a list of all Contractors. Currently to get it working I am defining a UsersTableEmployees webservice within component #1 and a UsersTableContractors webservice within component #2, but they both point to the same PHP class, and only differ in the arugment value I pass to them. Ie, getUsers("employee") and getUsers ("contractors"). Of course this is not best practice.

Searching StackOverflow and Google gives me many results about ColdFusion and MVC (example What's the best way to share data between components in Flex?), but I'm still confused. Can anyone here point me to a basic example (even sample MVC) and source code of an app that uses Zend AMF and allows different components to call common web services?

View 1 Replies

Flex :: Create Advanced Flex Custom Components Library?

Nov 25, 2011

I want to create a custom component library. the components are customize-able during creation time. means like Accordion or TabNavigator, when we drag and drop the Accordion in flash builder it

<mx:Accordion x="38" y="167" width="200" height="200">
<s:NavigatorContent width="100%" height="100%" label="Accordion Pane 1">
</s:NavigatorContent>

[code]....

View 2 Replies

Flex :: Prevent Dragging Of A HDividedBox's Divider Based On A Condition

Feb 23, 2010

I'd love to be able to prevent dragging of a HDividedBox's divider based on a condition. for example:

[Code]...

View 3 Replies

Flex :: Selected Item In A Tree Is Not Highlighted After Dragging And Dropping It?

Jul 24, 2011

I have a Flex (3.5) Tree with drag & drop support, but the problem is that after I drag an item (node) and drop it, it's supposed to be the selected item in the tree, but for some reason it's not highlighted.

View 1 Replies

Flex :: Drag - Change The Size Of Container With Mouse Dragging?

Dec 21, 2011

When you drag the edge of container with mouse ,how to implement changing the size of container?

View 1 Replies

Flex :: Bubbling Events Within Custom Components In Flex?

Jan 11, 2010

I am using a custom component within another custom component in a flex mxml application file.Is it possible to bubble events from an inner component to the outer component and handle events in the outer component?

View 3 Replies

Flex :: Drag Manager - Access The Target Of Dragging Event In DragDropHandler?

Mar 29, 2011

I'm making a Matching Game where I have some images on my left and I can drag them onto images on my right and if they are matching, they should both disappear from the stage.

[Code]....

findMatch() is a function that finds in my XML file the path of the file that matches the file that is being dragged. Having that path, I send it to dragEnterHandler where it compares it with the path of the dropTarget file and if they are the same, it accepts it. Then in dragDropHandler, I'm changing the source path of my second image to "", so that it disappears from the stage. How can I access the first file (the one that was being dragged), so that I can change its path to "", to get rid of it?

View 1 Replies

Flex :: Make A Set Of Flex Components A Unit?

Nov 8, 2009

I'd like to make a series of components into a solid, consistently repeatable object. For example, suppose I have a "notification" template that I want to add to a notifications area every time something new happens. This template includes an icon (Image), text (label), and some space between these two things.

I want to take a template like that and make it so I can invoke it with a function like add_notification("icon", "text"). How would I go about doing that?

View 1 Replies

Flex :: Using Flash Components Into Flex Application?

Sep 14, 2010

What is the right way for integrating a Flash component into a Flex application? I heard that there are different ways of integration between Flash and Flex: using SWF, using SWC (something else?). What are theirs pros and cons? What are the points of communication between them Flash and Flex? `I'm using Flash Builder 4 for developing Flex. And Flash Professional CS 5 for developing Flash.

View 1 Replies

Actionscript :: Use Components Code In Mmxl Components

May 8, 2011

how i can use actionscript component code in mmxl components,as in actionscript components we use classes ,but in mmxl component we can not use classes function, so how i can use actionscript component code in mmxl component

[Code]...

but i cant use this code in mmxl components how i can use public class DialogTitle extends HBox implements IBindingClient in mmxl component code,what are the way to use it,sorry i am newbie if it is silly question

View 1 Replies

Adding Flex Components Using Xml?

Jul 28, 2009

I have a dozen different custom components in my flex app. I want to use an external xml config file to load the components at run-tine. Can someone tell me whats the best way to architect this? I want to load these components and add dataProviders and event liseners to them at runtime.

View 1 Replies

Flex :: Getting Components At Runtime?

Feb 18, 2010

<mx:Repeater id="rep" dataProvider="{headingData.component}">
<mx:HBox id="panel" label="{rep.currentItem.title}"
width="100%" height="100%">

[Code]....

When i am not placing it under a repeater tag, the components are created from XML, but if i do then the components are not getting created.

<components type="array">
<component type="mx.controls::ComboBox" title="Title One" description="Lorem Ipsum

is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

" width="230" height="220">
<link linkname="Option one"/>
<link linkname="Option Two"/>
</component>

<component type="mx.controls::RadioButton" title="Title Two" width="230" description="Lorem Ipsum

is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like AldusPageMaker including versions of Lorem Ipsum.">

<link linkname="Option one"/>
<link linkname="Option Two"/>
</component>

[code]....

View 2 Replies

Flex :: How To Move Components

Jan 16, 2011

I have a component

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="16" height="16" >
<mx:Script>

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved