I've driven myself crazy trying to make this work and haven't succeeded as 
yet. So I want to throw this out there for some advice.

There is a sprite that contains a bitmap that must display when the user 
clicks a region of the screen. The sprite must zoom from the point of the 
mouse click to it's full size, which is 600x240 on an 800x600 stage. The 
sprite when fully zoomed will always occupy the same pixel location, which 
has the upper left corner at point(99, 170).

The point from which the zoom emanates is the clickLoc, so the image will 
have to zoom from a different regpoint every time the user clicks a 
different pixel.

I can make this work with imaging Lingo if the image zooms from the center, 
left edge or presumably the right edge of the sprite. But I can't get it to 
zoom from whatever pixel is clicked so that it reaches it's full size in 
the same location no matter what.

I've also tried this by converting the bitmap to a vector in Flash and 
using the Flash Lingo to scale it. Again, I can scale it fine, but am not 
able to get it to scale from the point needed to the proper location on the 
screen.

One version of some successful code that doesn't quite do what I want 
follows. It presupposes that all zooming will come from one of three points 
on the left side of the image. But that's not what the client wants. A 
fourth condition in the if-then has been deleted. In it, I tried to find 
where the click would occur proportionally in the fully zoomed image. I 
think I have that calculated right. But once I have that info, I seem 
unable to make it work properly.

This is from a movie script in a simple movie. Once I have it working, I'll 
turn it into a behavior and get rid of the argument as the clickLoc should 
provide all the info needed to send to the sprite.

--upper left corner of sprite has to be at point(99, 170) regardless of 
regLevel once image is fully zoomed. in the ultimage behavior

on mZoom me, regLevel
   newMem = new (#bitmap)                      --create a new member
   newMem.name = "dynamic_chalkboard_bitmap"   --name it
   newMem.regpoint = point(0, 0)               --set the regPoint so that 
we can control its position and make sure it zooms from the left
   defaultLocH = 99            --left edge of sprite must be at this value
   defaultLocV = 170           --right edge of sprite must be at this value
   widthIncrement = 15         --number of pixels image will zoom by 
horizontally through each loop
   heightIncrement = 6         --number of pixels image will zoom by 
vertically through each loop
   maxWidth = 600              --full sized width of image
   maxHeight = 240             --full sized height of image
   repeatCount = maxWidth / widthIncrement -- how many times to run through 
the repeat loop until full size is reached
   repeat with i = 1 to repeatCount
     currWidth = widthIncrement * i
     currHeight = heightIncrement * i
     dynaImage = image(currWidth, currHeight, 32)--(width, height, bit depth)
     dynaImage.fill(dynaImage.rect, rgb(0, 0, 0))
     --copy the newly created image into the newly created member
     newMem.image = dynaImage
     if regLevel = "top" then
       -- registration point relative to point(defaultLocH, defaultLocV). 
zooms from upper left
       regV = point(0, 0)
       sprite(1).loc = point(defaultLocH, defaultLocV)
     else if regLevel = "middle" then
       regV = point(0, newMem.height/2) -- zooms from middle
       sprite(1).loc = point(defaultLocH, defaultLocV + (maxHeight/2) )
     else if regLevel = "bottom" then
       regV = point(0, newMem.height) -- zooms from bottom
       sprite(1).loc = point(defaultLocH, defaultLocV + maxHeight)
     end if
     newMem.regpoint = regV
     newMem.image.copyPixels(member("chalkboard_high").image, 
newMem.image.rect, member("chalkboard_high").rect)
     sprite(1).member = newMem
     updateStage
   end repeat
end

Thanks for any thoughts you might have.

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to