O'Reilly logo

ActionScript Graphing Cookbook by Peter Backx, Dominic Gélineau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dragging data points to new values

In this chapter, we'll use a few ideas from the previous recipes to make that actual graph data draggable. When the recipe is implemented, the user can click-and-drag data points to new locations.

Getting ready

We will start from the familiar point graph:

package com.graphing.drag { import flash.display.Sprite; import com.graphing.PointGraph; public class Recipe6 extends Sprite { private var _graph:PointGraph; private var _data:Array = [[0,20],[50,70],[100,0],[150,150],[200,300],[250,200],[300,400],[350,20],[400,60],[450,250],[500,90],[550,400],[600,500],[650,450],[700,320]]; public function Recipe6() { _graph = new PointGraph(); _graph.data = _data; _graph.graphWidth = 800; _graph.graphHeight = 600; _graph.graphLeft ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required