Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Fade till done
Slide show
ScrnXtra
Blur Static-Alphamania
Volume Controller SWA(Shockwave Audio)
WebCamXtra - Computer Vision & Camera Tracking
simODBC Xtra
asASIOout
Set actionsEnabled Property of a Flash Member
Director 7 and Lingo Bible
 

 

 

Behavior Vector Shape - Create Grid

Added on 2/7/2006

 

Compatibilities:
D8 D8_5 D9 Mac PC

This item has not yet been rated

Author: Chunick (website)

This custom handler will create a grid pattern. One key thing to remember with all vector shapes is that there is a size limit of 2798 pixels wide or high. The first four parameters are self-explanatory. The last one, autoSize, when set to True, will set the width and height of the rows and colums to fit within the width and height specified... otherwise, the width and height are the values for each grid so a 25px by 25 px grid square at 5x5 squares would be 125x125 pixels wide by high... but with autoSize, if width and heigh were set to 100 each and the number of columns and rows were set to 4 and 5 then an individual square would be 25x20.

on createGrid (width, height, rows, cols, autoSize)
  
  vertList = []
  
  if autoSize then
    w = width / float(rows)
    h = height / float(cols)
  else  
    w = width
    h = height
  end if
  
  baseRect = [[#vertex: point(0, 0)], [#vertex: point(w, 0)], [#vertex: point(w, h)], [#vertex: point(0, h)]]
  
  rows = rows - 1
  cols = cols - 1
  
  repeat with x = 0 to rows
    repeat with y = 0 to cols
      thePoint = point(w * x, h * y)
      repeat with i in baseRect
        vertList.add(i + thePoint)
      end repeat
      vertList.add([#newCurve])
    end repeat
  end repeat
  vertList.deleteAt(vertList.count)
  
  return vertList
  
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail