Here is an example that makes a tree scroll when dragging near the border. Perhaps it will give you some ideas.
http://www.cflex.net/showfiledetails.cfm?ObjectID=134 Tracy -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Prasad Dhananjaya Sent: Monday, October 03, 2005 3:28 AM To: FlexML Subject: [flexcoders] Questing about Automatic Scrolling Hi, Have a problem with automatic Scrolling. Can someone help me.. There are 2 canvas in my test application. Size of the "JobNetCanves" is 10 times than "fullMapCanves". On the "fullMapCanves" there is a image(call "selector") which is dragable inside the canvas. What I want to do is .. when I move "selector", scrollbar of "JobNetCanves" also want to move automatically.(When moving "selector" inside the "fullMapCanves",left top cordinates of the "JobNetCanves" is same as "selector.x*10", "selector.y*10") Can someone tell me how to do this.. thanks. P.S. I think I can do this with using vPosition & hPosition . But not clear how to get/set values. -------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" pageTitle="TestAppli"> <mx:Script> <![CDATA[ var vScrollValue; var hScrollValue; //Drawing coordinates on "JobNetCanves" function drawStuff(event){ var xx:Number; var yy:Number; var ref_mc = JobNetCanves.createChild(mx.containers.Canvas,undefined,{width:4000, height:1500}); for (xx=35;xx<4000;xx=xx+75){ for (yy=35;yy<1500;yy=yy+75){ ref_mc.fillRect(xx, yy, xx+5, yy+5, 0x000000, 30); } } } //Drawing coordinates on "fullMapCanves" function drawStuff1(event){ var xv:Number; var yv:Number; var ref_mc = fullMapCanves.createChild(mx.containers.Canvas,undefined,{width:400, height:150}); for (xv=3;xv<400;xv=xv+7){ for (yv=3;yv<150;yv=yv+7){ ref_mc.fillRect(xv, yv, xv+1, yv+1, 0x000000, 30); } } } var bIsDown:Boolean = false; var lastX:Number; var lastY:Number; function doMouseDown(){ bIsDown = true; var lastX = mouseX; var lastY = mouseY; } function doMouseUp(){ bIsDown = false; dispatchEvent({type: "selectionChanged", x1: selector.x, x2: selector.x+selector.width, y1: selector.y, y2: selector.y+selector.height}); var hScrollValue=selector.x; var vScrollValue=selector.y; } function doMouseMove(){ if (bIsDown){ var deltaX = mouseX - lastX; var deltaY = mouseY - lastY; selector.x += deltaX; selector.y += deltaY; lastX = mouseX; lastY = mouseY; } } ]]> </mx:Script> <mx:Panel width="100%" height="100%" title="Testpanel"> <mx:Canvas width="100%" height="100%"> <mx:Canvas id="JobNetCanves" x="0" y="0" width="100%" height="225" backgroundColor="#CCCCCC" creationComplete="drawStuff()" vScrollPolicy="on" mouseMove="doMouseMove()" ★ vPosition="{vScrollValue}" hPosition="{hScrollValue}"> </mx:Canvas> <mx:Canvas id="fullMapCanves" x="3" y="225" width="400" height="150" backgroundAlpha="100" backgroundColor="#DEE0FE" creationComplete="drawStuff1()" mouseMove="doMouseMove()"> <mx:Image id="selector" source="jo1.jpg" width="10" height="10" mouseDown="doMouseDown()" mouseUp="doMouseUp()"/> </mx:Canvas> </mx:Canvas> </mx:Panel> </mx:Application> -- 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 ------------------------ 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/