Hi,
This may solve ur prob.
[This code is a block of class]
obj here is same as _rect in your class.
I guess you need not use addEventListener...
This works out!!!
function createChildren():Void{
obj = attachMovie("cir_sym","cir_sym",1)
}
function onMouseDown():Void{
obj.startDrag()
}
function onMouseUp():Void{
stopDrag()
}
Buzz back!!
obj = attachMovie("cir_sym","cir_sym",1)
}
function onMouseDown():Void{
obj.startDrag()
}
function onMouseUp():Void{
stopDrag()
}
Buzz back!!
On 10/8/05, Mink, Joseph <[EMAIL PROTECTED]> wrote:
Does anyone know how to get startDrag (...) and stopDrag (...) to work
with UIObjects in Flex? I know that in Flash the usage is typically:
on(press) {
startDrag(this,true);
}
on(release) {
stopDrag();
}
But maybe it could work with our mouseDown and mouseUp events? I am
currently trying it with this code, but it's not working:
import mx.containers.Canvas;
import mx.utils.Delegate;
class Rect extends Canvas
{
public var radius:Number;
private var _rect:Object;
/*
Constructor.
*/
function Circle ()
{
super ();
addEventListener("mouseUp", Delegate.create(this,
mouseUp));
addEventListener("mouseDown", Delegate.create(this,
mouseDown));
}
/*
Instantiates all child objects.
*/
function createChildren():Void
{
trace ("Begin Circle.createChildren ().");
super.createChildren();
if (_rect == undefined)
{
_rect = createEmptyObject("square",
getNextHighestDepth());
_rect.fillRect(0, 0, radius, radius, 0x000000,
100);
}
trace ("End Circle.createChildren().");
}
function mouseDown (event):Void
{
trace ("Begin Circle.mouseDown ");
/*_isMouseDown = true;
_lastMouseX = mouseX;
_lastMouseY = mouseY;*/
startDrag (this, true);
trace ("End Circle.mouseDown ");
}
function mouseUp(event):Void
{
trace ("Begin Circle.mouseUp");
//_isMouseDown = false;
stopDrag ();
trace ("End Circle.mouseUp");
}
}
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

