Panning image help

Hello :slight_smile:

Im having a bit of trouble on the panning image im working on. Theres a couple things I wanna do to it but im not quite sure how. Im useing partial code form the infinate menu tutorial but added a y axis onto it. Im working with a really big image so Instead of making the image infinate, how would I set up boundries so that the image could scroll to a certain point and then stop when it reaches the end. the map movie code is just this.

onClipEvent (load)
{
xcenter=350;
ycenter=200;

speed=1/20;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distancespeed);
var distance=_root._ymouse-ycenter;
_y+=(distance
speed);
}

I also wanted to make it so the camera zooms in at certain points on the image. Any help is very much appreciated as always.

Thanks in advance,
Zach

Use the startDrag() action. You can assign bounds to your clip as parameters; check the actionscript reference. I’m not sure how this would work if you scale the mc (I don’t know if the parameters scale too, but if you are dragging an mc within an mc I think it should work).

When you say camera, do you mean your mouse? You’ll have to come up with some relationship between the mouse position and the center of the clip. To scale the clip, all you need ot do is affect the _xscale and _yscale properties:

[AS]
onClipEvent(enterFrame){
this._xscale = this._xscale*value;
this._yscale = this._xscale;
}
onClipEvent(load){
value = 1;
}
on(press){
value = 1.1;
}
on(release){
value = 1;
}
[/AS]
or something to that effect.

Have a play around and let us all know how you go.

Thanks for your help Carixpig I’m starting to learn a bit more about what I need to do in order for this to work. Im a little confused about the startdrag option though. From what I read it should work on what im doing but im not exactly sure on how to set the bound locks on an image thats 2300 1725 pixels big.could you give me an example of how to use it using those as the cordiantes for the stops. You also had the right idea about the x and y scale properties. My only question in that regard is how to make it so it only scales at certain points on the image.

thanks again for your help,
Zach

1725

You can’t scale only certain points on the image without some complex AS and some masking trickery. You have to scale the whole image and use AS to locate it (so that the part you zoom in on stays centred). Put your image under a mask so that it doesn’t overflow the stage.

I think the startDrag action relates to the registration point of your movie clip. If this is true, it might be easier to make the registration point of the image the top left, because its position on the stage (in the properties inpector) is measured from the top left.

I’m about to quit for the night, so if you hang in there I’ll post something later that might help.

Hey Zach,

http://www.mucreative.com/DragSample.zip

A simple fla with a draggable mc with bounds. I experimented briefly with changing the bounds dynamically but it was becoming a pain in the arse. If anyone else has some clues on this it would be nice.

If I ever get to doing what you want with scaling only certain parts, then I’ll post it here. Until then, play with the drag option.

Chris

Thanks so much for your help Chris. I’ll check the website when my bro gets up for work in a couple hours. I just wanted to let you know you’ve been a great help. I’ll definately let you know how my project turns out. Keep in touch.

Thanks again,
Zach

You’re welcome