[Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread julian atienza
Hello.

I'm developing a sort application in Flash 8 / AS2 for manage big size
images and scale/navigate thru them.

I always have to load a big image into a MovieClip, and i have to make
a similar-tool to photoshop navigation panel, so i have now to
duplicate current scaled image in a small thumbnail into navigation
panel.

To avoid loading twice times the image (first in 100% and second in
thumbnail navigation image) ... how could i copy content of first
movieclip to second one with fixed size?

thanks in advance
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Dave Mennenoh
To avoid loading twice times the image (first in 100% and second in 
thumbnail navigation image) ... how could i copy content of first 
movieclip to second one with fixed size?


You can't really, but since the image is cached once it's downloaded the 
first time, loading it again into the thumbnail will be nearly instant.



Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Alan MacDougall

julian atienza wrote:

To avoid loading twice times the image (first in 100% and second in
thumbnail navigation image) ... how could i copy content of first
movieclip to second one with fixed size
I did something similar to this while trying to implement my own 
Bitmap-based magnifying glass (following this example by Grant Skinner: 
http://www.gskinner.com/blog/archives/2005/09/flash_8_bluepri.html). You 
can use a single MovieClip as the source for as many individual bitmaps 
as you want, limited only by your CPU power. Look up the basics of 
attaching bitmaps and using BitmapData.draw -- that's all readily 
available in the manuals and tutorials. Then just create two bitmaps 
attached to two movieclips, and do this:


// assume that source is the MovieClip containing the original image
var matrix:Matrix;
var normalScale:Number = 1.0;
var thumbScale:Number = 0.25;
  
// draw to the bitmap at the normal scale

matrix = source.transform.matrix;
matrix.scale(normalScale, normalScale);
normalBitmap.draw(source, matrix);
  
// draw to the bitmap at the thumbnail scale

matrix = source.transform.matrix;
matrix.scale(thumbScale, thumbScale);
thumbBitmap.draw(source, matrix);

Now the normalBitmap (a BitmapData object) has your image at full size, 
and thumbBitmap has the image at 1/4 size.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Alan MacDougall

Dave Mennenoh wrote:
To avoid loading twice times the image (first in 100% and second in 
thumbnail navigation image) ... how could i copy content of first 
movieclip to second one with fixed size?


You can't really, but since the image is cached once it's downloaded 
the first time, loading it again into the thumbnail will be nearly 
instant.
Hah... I posted an overly-fancy BitmapData copying solution -- it hasn't 
gone through yet -- but Dave's answer is a lot better. If both versions 
of the image are static, just loadMovie them both. I originally did that 
BitmapData thing to display a magnified area of a complex clip generated 
from user input, but it's overkill for static images.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Marcelo de Moraes Serpa
If you are using Flash 8+ you could use the Bitmapdata datatype to copy it
to a new movieclip and scale it to thumbnail size I think.


On 8/23/07, Alan MacDougall [EMAIL PROTECTED] wrote:

 julian atienza wrote:
  To avoid loading twice times the image (first in 100% and second in
  thumbnail navigation image) ... how could i copy content of first
  movieclip to second one with fixed size
 I did something similar to this while trying to implement my own
 Bitmap-based magnifying glass (following this example by Grant Skinner:
 http://www.gskinner.com/blog/archives/2005/09/flash_8_bluepri.html). You
 can use a single MovieClip as the source for as many individual bitmaps
 as you want, limited only by your CPU power. Look up the basics of
 attaching bitmaps and using BitmapData.draw -- that's all readily
 available in the manuals and tutorials. Then just create two bitmaps
 attached to two movieclips, and do this:

 // assume that source is the MovieClip containing the original image
 var matrix:Matrix;
 var normalScale:Number = 1.0;
 var thumbScale:Number = 0.25;

 // draw to the bitmap at the normal scale
 matrix = source.transform.matrix;
 matrix.scale(normalScale, normalScale);
 normalBitmap.draw(source, matrix);

 // draw to the bitmap at the thumbnail scale
 matrix = source.transform.matrix;
 matrix.scale(thumbScale, thumbScale);
 thumbBitmap.draw(source, matrix);

 Now the normalBitmap (a BitmapData object) has your image at full size,
 and thumbBitmap has the image at 1/4 size.

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Marcelo de Moraes Serpa
I think he wants to load the big image and then load it again but resize
it. If that's what you want, just load image with loadMovie or
MovieClipLoader and once it has been cached, load it again (the same url) to
a redimensioned MovieClip.

On 8/23/07, Alan MacDougall [EMAIL PROTECTED] wrote:

 Dave Mennenoh wrote:
  To avoid loading twice times the image (first in 100% and second in
  thumbnail navigation image) ... how could i copy content of first
  movieclip to second one with fixed size?
 
  You can't really, but since the image is cached once it's downloaded
  the first time, loading it again into the thumbnail will be nearly
  instant.
 Hah... I posted an overly-fancy BitmapData copying solution -- it hasn't
 gone through yet -- but Dave's answer is a lot better. If both versions
 of the image are static, just loadMovie them both. I originally did that
 BitmapData thing to display a magnified area of a complex clip generated
 from user input, but it's overkill for static images.

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread julian atienza
I fear it is not my solution. Image is 72Mb. The application i was
making is a standalone one (not a web solution)... When i try to load
the second one , the time is the double :/

2007/8/23, Marcelo de Moraes Serpa [EMAIL PROTECTED]:
 I think he wants to load the big image and then load it again but resize
 it. If that's what you want, just load image with loadMovie or
 MovieClipLoader and once it has been cached, load it again (the same url) to
 a redimensioned MovieClip.

 On 8/23/07, Alan MacDougall [EMAIL PROTECTED] wrote:
 
  Dave Mennenoh wrote:
   To avoid loading twice times the image (first in 100% and second in
   thumbnail navigation image) ... how could i copy content of first
   movieclip to second one with fixed size?
  
   You can't really, but since the image is cached once it's downloaded
   the first time, loading it again into the thumbnail will be nearly
   instant.
  Hah... I posted an overly-fancy BitmapData copying solution -- it hasn't
  gone through yet -- but Dave's answer is a lot better. If both versions
  of the image are static, just loadMovie them both. I originally did that
  BitmapData thing to display a magnified area of a complex clip generated
  from user input, but it's overkill for static images.
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Alan MacDougall

julian atienza wrote:

Image is 72Mb.
  


This is your first problem. I can't think of a single reason you would 
have to load a 72 MB image into Flash. Could you tell us a little more 
about your application?


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread julian atienza
One High-Resolution Graphic explorer.

Before 3 seconds, flash load correctly that big size, and i'm trying
this inside my class:

{ 
(my class has the typical movieclip loader with addListener(this);   )
.
public function onLoadInit(mcTarget:MovieClip):Void {
   //Big size image is now loaded at 100% size !!!
   //i have to copy scaled image to thumbnail for
   //Navigation purposes like in photoshop

   //Calculate factor
   var factorH:Number = _mcThumbnail._height / mcTarget._height;
   var factorW:Number = _mcThumbnail._width / mcTarget._width;

   //copy bitmap with matrix transformation
   _myBitMap = new
BitmapData(_mcThumbnail._width,_mcThumbnail._height,false,0x00FF);
   _myMatrix = mcTarget.transform.matrix;
   _myMatrix.scale(factorH,factorW);
   _myBitMap.draw(mcTarget,_myMatrix);
  //I catch it! - now i have the bitmap
   _mcThumbnail.attachBitmap(_myBitMap,1);
}

but i'm not sure if it's going ok... at least  now i haven't to make
another load but... i think the thumbnail is scaling the portion of
big image i see in screen, not the whole image...

Excuse my english :( i'm trying to explain it as fine as i can. Thanks


2007/8/23, Alan MacDougall [EMAIL PROTECTED]:
 julian atienza wrote:
  Image is 72Mb.
 

 This is your first problem. I can't think of a single reason you would
 have to load a 72 MB image into Flash. Could you tell us a little more
 about your application?

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Big size Image and Thumbnail

2007-08-23 Thread Alan MacDougall

julian atienza wrote:

but i'm not sure if it's going ok... at least  now i haven't to make
another load but... i think the thumbnail is scaling the portion of
big image i see in screen, not the whole image...
  


That might be a limitation of Flash. I'm not sure what happens when 
MovieClips and BitmapData are larger than the maximum movie size (which 
I think is 2600 pixels or so)... I would not be surprised if it messes 
up, though.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com