Old experiment: pan through an image with actionscript
June 4, 2007 by Emanuele Feronato
Filed Under Flash •
Filed Under Flash •
This is an experiment made in 2004 translated into a newer version of actionscript.
It's very simple and needs a lot of improvements and I think you could transform this file into something usable.
The actionscript, all in the first frame, is very simple: the two objects are the_arrow representing the mouse pointer and map representing the image.
ACTIONSCRIPT:
-
Mouse.hide();
-
_root.attachMovie("map", "map", 1);
-
_root.attachMovie("the_arrow", "the_arrow", 2, {_x:250, _y:175});
-
the_arrow.onEnterFrame = function() {
-
this._x += (_xmouse-this._x)/5;
-
this._y += (_ymouse-this._y)/5;
-
dist_x = this._x-250;
-
dist_y = this._y-175;
-
angle = Math.atan(dist_y/dist_x)/(Math.PI/180);
-
if (dist_x<0) {
-
angle += 180;
-
}
-
if (dist_x>=0 and dist_y<0) {
-
angle += 360;
-
}
-
this._rotation = angle;
-
deltax = -(this._x-250)/90;
-
deltay = -(this._y-175)/90;
-
map._x += deltax;
-
map._y += deltay;
-
if (map._x>1000) {
-
map._x = 1000;
-
}
-
if (map._x<-500) {
-
map._x = -500;
-
}
-
if (map._y>1000) {
-
map._x = 1000;
-
}
-
if (map._y<-650) {
-
map._y = -650;
-
}
-
-
};
Being an old experiment, I won't comment it, but someday I am going to release a newer, released version.
Here it is the source code for you to enjoy.
Improve the blog rating this post
Tell me what do you think about this post. I'll write better and better entries.
Tell me what do you think about this post. I'll write better and better entries.
» Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.
They can be easily customized to meet the unique requirements of your project.
5 Responses to “Old experiment: pan through an image with actionscript”
Leave a Reply


(3 votes, average: 3.33 out of 5)
Thanks a lot.
Looking forward for the newer version.
I think it’s very impressive you’re doing almost all your project open source.
- V34
Hi this is a sample image used in this example enjoy
Thanks a lot.
Very nice of you putting this experiment on your site. Very simple, easy to understand and i can imagine practical applications.
Just a question, in line 28, wouldn’t be “.y” insted of “.x”?
Thanks a lot.
excelent!! como puedo lograr ke avance mas rapido?