MbDragTile extends Sprite

use | constructors | public vars | constants | strings | comparisons | conversions | get/set

Use

note: MbDragTile uses MbDragTarget, which has one public methods. An MbDragTarget is basically a sprite that can be visible or invisible, and can have a label.

 

Registration point (for symbols from the library) should be in the upper left hand corner PLEASE!

Constructors

MbTileAuto(shape_:String, txt_, board_, xx, yy)

shape_ can be "rect", "rrect", or "circ", resizes automatically

MbTileCode(shape_:String, txt_, board_, xx, yy)

shape_ can be "rect", "rrect", or "circ", default is 40 x 40

no resizing, so all tiles can be set to the same size

MbTileGif(gif:String, txt_, board_, xx, yy)

gif is given as a path, and loaded automatically

MbTileLib(lib:MovieClip, txt_, board_, xx, yy)

library object must be provided

if tile is already on the stage, use libInstance.x and .y as xx and yy -- otherwise leave out

 

txt_ defines text to be displayed on sprite

board defines where the tile is allowed to move -- cannot be stage

mouse_down event is added automatically

x and y are considered "home" for the tile

Getters/Setters

getCorrTarget(n:int)

getWrongTarget(n:int)

Specific Methods for MbTileAuto and MbTileCode

setShape(shape_:String="rect", wid_:int=40, ht_:int=40, outlineWid_:int=2)
setColor(fillCol_:uint=MbColor.MAIN_LIGHT, outlineCol_:uint=MbColor.MAIN_DARK)

Methods

addTargetPoint(kind:String, xx, yy, xTol=20, yTol=20, txt="", isVis=true)

creates a target for the tile

use kind=="correct" | "good" for correct target

use kind=="wrong" | "bad" for incorrect targets

target size is double the tolerances given

addTargetRegion(kind:String, xx, yy, wid, height, txt="", isVis=true)

like above, but a rectangular region is created

addTargetSprite(kind:String, s:MovieClip, xx=-999, yy=-999, txt="", isVis=true)

same as above, except a display object should be provided

pass a newly constructed MovieClip or one already on the stage

use xx and yy == -999 if the symbol is already on the stage

moveToHome()
putToHome()

forces move to home

moveToHome "floats" the tile home

putToHome relocates tile instantaneously

public function moveToFinal()

forces move to final position

public function moveTo(xx, yy)

forces move to arbitrary location

Getters/Setters

enableDrag(), disableDrag()
getMidX(), getMidY()
getCorrX(), getCorrY()
setHome(xx, yy)

 

MbDragTarget extends Sprite

 

setCorrPos(tile:DisplayObject, percX:Number, percY:Number)