Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-11-2003, 06:16 PM   #1
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default [Q] Problem with zooming the map and the location/size of the movieclip inside of it.

Howdy, guys...

I am trying to think of ways of doing this stuff and I am kinda stuck...

Here is what I want to do...
For example, let's say that I am making a program that shows a map within a scroll pane component... That map needs to be zoomed in and out which I have no problem doing it... I have a functionality that I can drag and drop a marker which is 10 x 10 square onto that map... What I do here is create an instance of that marker everytime I(user) click on the marker icon and do the drag and drop with that instance into the movieclip of the map...

The problem I am having is that the marker gets expanded and reduced when the map is resized by zooming function since the marker is laid inside the movieclip where the map is sitting... I don't want the marker resized everytime the map is zoomed in or out...

Let's just say that the map is 300 x 200, and that is the size of the scroll pane also... I drag and drop the marker at 100 x 100 location in 100% zoomed view... (marker is 10 x 10)
If I zoom the map to be 200%, the map becomes 600 x 400, and the marker should be located at 200 x 200 location with 10 x 10 pixel size... That is what it should be, but what happens is the marker becomes 20 x 20... I thought of reducing the marker movieclip according to the zoom ratio, but if I do, I get the location problem... The marker goes to 205 x 205 instead of 200 x 200 when it is reduced... The marker should be pointing the exact location, so I cannot accept 205 x 205... I played with the registration position of the marker icon, but it didn't make much difference whether the registration position is the center or the top right...

I hope I have explained my problem well... Does anybody shed some light on my exhausted brain??? Is there any way of doing this???

Thank you and have a nice weekend...

Jason
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-12-2003, 01:03 PM   #2
stephenF
Registered User
 
Join Date: Oct 2001
Location: Brisbane, Australia
Posts: 140
Default

I think the ratio idea should work. Make sure your registration point in your marker clip is exactly centred - _xscale and _yscale expands from the rego point, so it will move away from the original point if not centred. Magnify right into it and put on outline only.


Good luck
stephenF is offline   Reply With Quote
Old 01-12-2003, 01:08 PM   #3
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Thanks for the reply, stephenF... I guess I gotta play with numbers again and again to find the magic number...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-12-2003, 02:17 PM   #4
stephenF
Registered User
 
Join Date: Oct 2001
Location: Brisbane, Australia
Posts: 140
Default

Sounds more complicated - maybe the registration point of the attached clips is different to the original. If 200 became 205 in both directions, I think that would put the rego points of the attached clips at the bottom right corner! Have you tried subtracting from the attached mc's x and y after the transformation? (ie, for doubling, subtracting 5?). If this is true, the amount to subtract for each scaling up would be:

ActionScript Code:
(marker._width/2)*(multiplier -1)

so, for scaling by 2, it would be 10/2*(2-1) =5, so you'd take 5 away from the x and y axes each time the marker is multiplied by 2. I don't know if that's the problem - it might be a heap of bull, but I hope something here helps
stephenF is offline   Reply With Quote
Old 01-12-2003, 07:01 PM   #5
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Thank you, stephenF, for the reply...

I had that sort of equation to get the right position when zoomed, but it was different depending on the zoom ratio...

I gotta say that this one is sitting a little while since I had some urgent project that I had to take care of...

I had zoom set to increase/decrease by 10% on each click and the location of the marker wasn't right all the time and it didn't look that consistent in all cases... I had set the registration point to the center of the marker movieclip since the movieclip's one end was pointing to something all the time...

Well... I think I will have some free time to get back to this project next week and I'll try to find that magic number/equation...

Thank you...

Jason
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-12-2003, 11:17 PM   #6
stephenF
Registered User
 
Join Date: Oct 2001
Location: Brisbane, Australia
Posts: 140
Default

The "multiplier" in my equation is the amount of zoom, but I haven't tried it and I guess it probably won't work, but something like it will. For the first 10% zoom, for example, "multiplier" would be 1.1, and would result in a .5 move away from the original point in both directions. Anyway, post when you get back to it and find a solution
stephenF is offline   Reply With Quote
Old 01-13-2003, 12:13 AM   #7
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Yup... I'll do that... Thanks again...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:02 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.