Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

action script zoom feature

Posted on 2009-02-12
14
Medium Priority
?
584 Views
Last Modified: 2013-11-11
Greeneel,
I thought of just one more feature that could be really good with the map. Would it be possible to add a zoom feature? What I'm thinking is this. When a list item is clicked not only would it center in on the the area it would also zoom in blowing the map up to 200%. Possible?  
0
Comment
Question by:Bm71
  • 7
  • 7
14 Comments
 
LVL 11

Assisted Solution

by:Eaddy Barnes
Eaddy Barnes earned 2000 total points
ID: 23625253
it is possible.
the following is the code you would need to alter the  map size with tween.

keep a few things in mind.
1. you would have to know the location of each building when its scaled out.
2. you wont be able to drag the map very far because the larger map would now be subject to those constraints places on it earlier.
3. you would need variables to hold the constraint numbers.
4. you would need to add motion tween listener for complete so when the map moves to a location it would zoom in or the other way around

what do you think

GE


	var tween_handlerX:Tween = new Tween(_root.mapall2, "_xscale", Strong.easeOut, _root.mapall2._width, (_root.mapall2._width * .5), 2, true);
	var tween_handlerY:Tween = new Tween(_root.mapall2, "_yscale", Strong.easeOut, _root.mapall2._height, (_root.mapall2._height * .5), 2, true);
 
// edit the values to get the desired effect

Open in new window

0
 

Author Comment

by:Bm71
ID: 23625400
The only part that sounds like a problem is your second point:

2. you wont be able to drag the map very far because the larger map would now be subject to those constraints places on it earlier.

if the whole map is scaled up would we the able to change the constraint parameters accordingly to fit the new size or does this get us into the problem that when the map is zoomed down you will be able to drag it out side the stage are?
0
 
LVL 11

Assisted Solution

by:Eaddy Barnes
Eaddy Barnes earned 2000 total points
ID: 23625543
store the constraints numbers in 4 different number vars on the main time line and see how it works.
and when you zoom adjust the numbers in those vars to suit the new dimensions of the map.

you may have to play with the numbers a bit.

should be at my comp in a few hours

Good Luck

GE

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Bm71
ID: 23625874
I'm away from my home computer until later too so I'll give a try then.

Thanks
Bm71
0
 

Author Comment

by:Bm71
ID: 23628931
I placed the new code and I see how the map is enlarged. I also see what you mean about the limits for how far you can drag the clip.

I have another idea about how to do the zoom feature. Let me know if we would be dealing with the same problems. Could we set up a zoom bar that has a slider? The bar would not be tied to the list in any way.

Bm71
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23628962
yes we would.
it wont be tied to the list
but it will still make the map larger

GE
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23629846
i think i found an answer.
0
 

Author Comment

by:Bm71
ID: 23629987
Ok, what is it?

Bm71
0
 
LVL 11

Accepted Solution

by:
Eaddy Barnes earned 2000 total points
ID: 23631659
1. we would have to change the constraint data to variables
2. introduce time class for a perfect transition from one place to the other
3. add 2 condition for when the map is zoomed or not.
4. send in location for when the map is zoomed and when its not.

these things at the right places and your all set

GE
0
 

Author Comment

by:Bm71
ID: 23632520
I'm curious, If this could be set up with my second idea of a zoom slider or is this with my original idea. At this point I'm kind of liking the zoom slider more.

Also, this looks a bit over my head (not surprising to you I'm sure) If you can lead me thought it step by step I would be grateful. Graphically is there anything I can start to set up to make all this work, or is it all code?

Bm71    
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23633026
at work at the moment
sorry for the delay
been a bit busy with work

i will give you a complete brake down ASAP (today)

GE
0
 
LVL 11

Expert Comment

by:Eaddy Barnes
ID: 23633032
no need to edit graphics.

0
 

Author Comment

by:Bm71
ID: 23633166
Thanks greeneel,
Talk to you soon.

Bm71
0
 

Author Comment

by:Bm71
ID: 23633191
In case you need it here's the code on the main time line as it is set up now.

import mx.controls.List;
/*mapall2.ubuildings._visible = false;*/
mapall2.ubuildings._alpha = 0;
mapall2.sports._alpha = 0;
mapall2.parking._alpha = 0;
mapall2.restaurants1._alpha = 0;
directory1.kraustext._visible = false;
buildingStatus = "on";
stop();


import mx.transitions.Tween;
import mx.transitions.easing.*;
var list:mx.controls.List;
 
list.addItem({data:"external_files/chemistry.swf", label:"Chemistry", locationX:-356.0, locationY: -138.7});
list.addItem({data:"external_files/graduate_library.swf", label:"Hatcher Library", locationX:-293.0, locationY: -240.7});
list.addItem({data:"external_files/kraus.swf", label:"Kraus Science", locationX:-247.0, locationY: -123.7});
 
list.selectedIndex = 0;
 
var listListener:Object = new Object();
listListener.change = function(evt_obj:Object) {
 
        loadMovieNum(list.dataProvider[list.selectedIndex].data, 23);
       
        var tween_handlerX:Tween = new Tween(_root.mapall2, "_x", Strong.easeOut, _root.mapall2._x, list.dataProvider[list.selectedIndex].locationX, 2, true);
        var tween_handlerY:Tween = new Tween(_root.mapall2, "_y", Strong.easeOut, _root.mapall2._y, list.dataProvider[list.selectedIndex].locationY, 2, true);
 
}
list.addEventListener("change", listListener);

Thanks Again,
Bm71
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question