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
THE JAB :
Reverse a list
Making the Projector Fill the Screen
Flashation Flash Menu Builder
Cutting Puzzle Pieces
DirectInteraction Xtra
f3VideoCapture
TranZtions
SMARTSCRIPT
DM Stars Field Effect
 

 

 

Behavior Dragging and Magnifying a Sprite

Added on 6/30/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

This item has not yet been rated

Author: KellyStewart

Here is a handler similar to what you describe. It doesn"t use a separate window or scroll bars but it may be a piece of your puzzle. Be sure to call it from a cast script "on MouseDown" instead of "on MouseUp" or it won"t work properly. The user is able to move the sprite by clicking and dragging, magnify by double clicking, and reduce by option-double clicking.

on pictureView
  -- Lingo by Kelly Stewart, NewOrder Media, Nashville
    global vMAGNIFICATION --set this initially to zero in your startMovie
    put the clickOn into theSprite
    puppetSprite theSprite, true
    put the locH of sprite theSprite - the mouseH into offH
    put the locV of sprite theSprite - the mouseV into offV

    --The following repeat gives you the movement when the mouse is down.
    --This first "if then" within the repeat checks for the mouse location so
    --the user can"t drag the sprite out of a custom-sized window.
    --Change the numbers to fit your needs or just delete it entirely.
    repeat while the mouseDown
        if the mouseH < 22 or the mouseH > 401 or the mouseV < 106 or the mouseV > 481 then
            set the cursor of sprite theSprite = 0
            exit
        end if
        set the cursor of sprite theSprite = 1005  --grabber hand
        set the locH of sprite theSprite = the mouseH + offH
        set the locV of sprite theSprite = the mouseV + offV
        updateStage
    end repeat
    set the cursor of sprite theSprite = 0
    if the doubleclick = false then exit
    set the stretch of sprite theSprite to true
    if the optiondown and the doubleclick and vMAGNIFICATION > -4 then
        --Can"t reduce it more than 4 times.
        set the cursor of sprite theSprite = 1007 --zoom out
        set the height of sprite theSprite to (integer(.666667 *  the height of sprite theSprite))
        set the width of sprite theSprite to (integer(.666667 *  the width of sprite theSprite))
        set vMAGNIFICATION = vMAGNIFICATION - 1
        updatestage
        set the cursor of sprite theSprite = 0
        exit
    end if
    if not the optiondown and vMAGNIFICATION < 4 then
        --Can"t magnify it more than 4 times.
        set the cursor of sprite theSprite = 1006 --zoom in
        set the height of sprite theSprite to (integer(1.5 *  the height of sprite theSprite))
        set the width of sprite theSprite to (integer(1.5 *  the width of sprite theSprite))
        set vMAGNIFICATION = vMAGNIFICATION + 1
        updatestage
    end if
    set the cursor of sprite theSprite = 0
    
    --Be sure to turn off all puppetsprites (set to false) later when you leave
    --this area of your movie. Make "theSprite" global if you want to track the
    --sprite number the user clicked on outside of this handler.
end pictureView

 


Contact

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

Send e-mail