PDA

View Full Version : click, and drag 9000x9000 image


crazylegsmurphy
06-10-2005, 06:40 PM
Hey all,

I'm not sure if you are allowed to do this on this site, but I am nearing the end of my project, and I really need this solved. I am offering $50 to the person who can help me solve this problem. I'll pay via paypal.

The problem.

I have a huge image 9000 x 9000 pixels (roughly) and I need the user to be able to click, and drag this image. This image is behind a mask.

This image also needs to be scaleable using + and - buttons.

I am using this scrips to scale the image:

// when you click the button
in_btn.onRelease = function()
{
// decrease it's _xscale by 5 until it's 10
my_mc._xscale = Math.max(my_mc._xscale - 15, 9);
// decrease the _yscale as well
my_mc._yscale = my_mc._xscale;
};
// exactly the same here, but with the opposite logic
out_btn.onRelease = function()
{
my_mc._xscale = Math.min(my_mc._xscale + 15, 100);
my_mc._yscale = my_mc._xscale;
};


So, what I have is a large image, that is scaleable. The part where this gets tricky is that I need this image to stop being draggable, when the INNER edge touches the edge of the mask.

Basically, I don't want the user to ever be able to drag the image past it's own edges.

Now, as the user zooms out, the same "rules" need to apply. The image needs to stay draggable, (to it's inner edge) as long as the image is bigger than the mask.

Once the user has zoomed out far enough, then the image should no longer be draggable.

It sounds complicated I know. If you think you have the solution then please contact me via . Feel free to ask as many questions as you need too, but I am only giving the $50 to the person who actually solves this problem though actual script.

Thanks!

Jeff

deadbeat
06-10-2005, 06:50 PM
Well, the absolute easiest way would be to simply use the scrollPane component with hScrollPoilcy and vScrollPolicy set to off, and scrollDrag=true...

By the way, have you actually managed to work with an image that size in Flash without problems?

K.

crazylegsmurphy
06-10-2005, 06:57 PM
No problems so far....that I can see...I haven't been able to get it to work, so I couldn't tell ya for sure.

If you can write that code, and it works, the $50 is yours dude! :D

Timmee_3Styler
06-10-2005, 07:03 PM
you have been able to drag a 9000 by 9000 pixel image around so far?

crazylegsmurphy
06-10-2005, 07:06 PM
you have been able to drag a 9000 by 9000 pixel image around so far?

when I use the typical drag script...yes...but it doesn't behave like I need.

deadbeat
06-10-2005, 07:41 PM
Why not use the ScrollPane? It will take like 2 minutes to implement...

K.

backdrop
06-10-2005, 07:45 PM
9000x9000... That's 81 million pixels... That's...a LOT of memory to shuffle around with. I don't think you'll be able to make it run smoothly.

crazylegsmurphy
06-10-2005, 08:08 PM
Why not use the ScrollPane? It will take like 2 minutes to implement...

K.

Please, show me how? I have no idea how to make that work as I have never heard of it.

9000x9000... That's 81 million pixels... That's...a LOT of memory to shuffle around with. I don't think you'll be able to make it run smoothly..

probably not...but I think this client cares more that it actually functions like they need it, then how smooth it is.

Timmee_3Styler
06-10-2005, 08:10 PM
Theres a program I have seen before, where you can chop up this big image into smaller one and display it on DEMAND...kinda like google maps ;)

so techincally ur working with fewer pixels @ a time

crazylegsmurphy
06-10-2005, 08:17 PM
Theres a program I have seen before, where you can chop up this big image into smaller one and display it on DEMAND...kinda like google maps ;)

so techincally ur working with fewer pixels @ a time


I may have to if it comes to that, but first things first I need to see if I can get it to do what I need it to do.

mmm..pi..3.14..
06-10-2005, 08:26 PM
I'm very close to having something, if you can hold on to that $50 for maybe 15 more minutes I should have it. I'll email it to you when I have it and post here to let you know when I sent it ;)

deadbeat
06-10-2005, 08:27 PM
Please, show me how? I have no idea how to make that work as I have never heard of it.

http://www.macromedia.com/livedocs/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002765.html#wp3157491

Open the Components Panel. Drag an instance of the ScrollPane to the stage. In the Properties inspector, set hScrollPolicy and vScrollPolicy to false. Set scrollDrag to true. Set contentPath to the linkage name of the large movieclip in the library.

Done.

To add the zooming, you can set the _xscale and _yscale of scrollPane.content...

K.

Timmee_3Styler
06-10-2005, 08:30 PM
nono let mmm..pi..3.14.. earn his 50 bucks ;)

crazylegsmurphy
06-10-2005, 08:36 PM
http://www.macromedia.com/livedocs/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002765.html#wp3157491

Open the Components Panel. Drag an instance of the ScrollPane to the stage. In the Properties inspector, set hScrollPolicy and vScrollPolicy to false. Set scrollDrag to true. Set contentPath to the linkage name of the large movieclip in the library.

Done.

To add the zooming, you can set the _xscale and _yscale of scrollPane.content...

K.

I'm trying this as we speak.

mmm..pi..3.14..
06-10-2005, 08:41 PM
lol, trying to beat you guys to it...this is driving me nuts trying to code at 200 words a minute :rolleyes:

Timmee_3Styler
06-10-2005, 08:43 PM
I am actually surprised that having a 9000 by 9000 jpeg will work in flash :)

crazylegsmurphy
06-10-2005, 08:54 PM
I can't get it to link to the MC :confused:

mmm..pi..3.14..
06-10-2005, 09:00 PM
Just sent you an email with a zip file attached to it. Let me know what you think... :D

Eric

crazylegsmurphy
06-10-2005, 09:04 PM
a-right...gimmy a sec

crazylegsmurphy
06-10-2005, 09:07 PM
Ohhhh you are beautiful!!

Any way you can get it too do two things? First, I would like it to zoom in steps...not in fluid motion...

And second, if you drag outside of the area, the drag "sticks" until you click again...can this be stopped?

mmm..pi..3.14..
06-10-2005, 09:16 PM
Oh, that's it?? lol...take me about 2 minutes...gimmee a sec. Anything else? Do you want me to try and smooth it out a little bit or is that alright with you? :D

crazylegsmurphy
06-10-2005, 09:21 PM
Oh, that's it?? lol...take me about 2 minutes...gimmee a sec. Anything else? Do you want me to try and smooth it out a little bit or is that alright with you? :D

Nope...as far as I can see...the sticking, and the steps makes it perfect....I'll test it of course in my actual project, but I think I can safely say I owe you $50! :)

mmm..pi..3.14..
06-10-2005, 09:32 PM
You know it does get stickier when you take away the smooth zoom? Still want me to keep it in steps?

BTW - My paypal address is: hainerrm AT AOL DOT COM << trying to avoid the spiders and all that :)

madgett
06-10-2005, 09:33 PM
Heh, I build a drag and drop component that does all that...:p, not only that, when you resize it everything inside the pane stays centered no matter what. Very nice indeed :)

mmm..pi..3.14..
06-10-2005, 09:36 PM
cool...but I beat you to it :p

madgett
06-10-2005, 09:37 PM
Haha, I'm not giving that component away for $50, worth more than that :p

mmm..pi..3.14..
06-10-2005, 09:39 PM
Hey, I'm not complaining...trying to save up for a new computer so I've been taking jobs left and right, doesn't matter to me how much I get, just as long as I get something :D

crazylegsmurphy
06-10-2005, 09:43 PM
You know it does get stickier when you take away the smooth zoom? Still want me to keep it in steps?

BTW - My paypal address is: hainerrm AT AOL DOT COM << trying to avoid the spiders and all that :)

Well, the steps is more important...if there is a way to get it to stick the least, then I'll be happy.

I really appreciate this! I'll paypal the cash to you asap.

I can't however get the image to show up in my project..the code seems to be working...but it can't find the image.

mmm..pi..3.14..
06-10-2005, 09:48 PM
The image is loaded externally, so the jpg "Aqua.jpg" needs to be in the same directory as the fla.

I'll see what I can do about the stickiness and email it to you, then you can pay me :)

crazylegsmurphy
06-10-2005, 09:54 PM
The image is loaded externally, so the jpg "Aqua.jpg" needs to be in the same directory as the fla.

I'll see what I can do about the stickiness and email it to you, then you can pay me :)

any way you can make the image load locally, within the project? Not a big deal if it can't but it would be a big help.

mmm..pi..3.14..
06-10-2005, 09:55 PM
Very easy, but I believe that would slow the loading time of your movie. A 9000 x 9000 pixel image has got to be a huge file :eek:

deadbeat
06-10-2005, 09:57 PM
Very easy, but I believe that would slow the loading time of your movie. A 9000 x 9000 pixel image has got to be a huge file :eek:

10 megs or so...

K.

mmm..pi..3.14..
06-10-2005, 09:59 PM
eep...don't know about 10 megs but if you say that around flash he's gonna put his tail between his legs and run away with Photoshop :p

crazylegsmurphy
06-10-2005, 10:29 PM
Ok here is where I am at....using you code...I can get the "aqua.jpg" image to load (not scale) but load and drag.

I can't get the huge image to load "toursheet.gif".....it worked (loaded) when it was in a MC...but it doesn't seem to like it externally.

crazylegsmurphy
06-10-2005, 10:39 PM
10 megs or so...

K.

642k

;)

It's only a GIF!!

mmm..pi..3.14..
06-10-2005, 10:44 PM
Oh, well that's why...Flash can't load external GIF images :)

I just sent you another email that seems alot smoother and the image is located within the library of the fla. Let me know what you think ;)

Eric

crazylegsmurphy
06-10-2005, 11:00 PM
Ok just give me a sec to put this all together...

crazylegsmurphy
06-10-2005, 11:08 PM
Ok, it's almost working....some funky stuff happening though...

when I click the "-" (minus) button it jumps all the way to small....the "+" works fine though...

hmmm...hold on check your e-mail

MaxFarago
06-10-2005, 11:16 PM
Hey guys, get a room.









just kidding...

mmm..pi..3.14..
06-10-2005, 11:16 PM
haven't gotten any emails yet, sure you sent it?

mmm..pi..3.14..
06-10-2005, 11:20 PM
nevermind, I just got it...