Thank you for help.
I created prototype http://www.mightybook.com/test/
that works similar to
http://www.zara.com/webapp/wcs/stores/servlet/category/us/en/zara-us-W2011-s/149501/
(page "event")
1. Sometimes an event "release" invokes when I press a mouse longer
trying to drag screen and move mouse slow. Another words sometimes I
zoom picture at the end of the movement.
Example page works perfect with draging screen.
How can I improve drag function for screen?
Here is some code
setMouseController=function(){
mouseController.onMouseDown = function(){
yOff=container_mc._y -_ymouse;
mouseController.onMouseMove=moveIt;}
}
mouseController.onMouseUp = function(){
delete mouseController.onMouseMove;
}
function moveIt() {
var thisY=(yOff+_ymouse);
if(thisY <= yMin)
thisY = yMin
if(thisY >= yMax)
thisY = yMax;
Tweener.addTween(container_mc, { _y:thisY, time:1,
transition:"easeOut",onComplete:finishMoveTween});
}
initPicAction=function(){
for (var i:Number=1; i<=lastNumber; i++){
var mc:MovieClip=container_mc["pic"+i];
mc.picNum.text=i;
mc.bg.onRelease=function(){
currentPic=this._parent;
Tweener.removeTweens(container_mc);
delete mouseController.onMouseMove;
delete mouseController.onMouseDown;
placeZommedPicture();
}
}
}
placeZommedPicture=function(){
if (!scaled){
var
targetXScale:Number=container_mc._xscale*scaleFactor;
var
targetYScale:Number=container_mc._yscale*scaleFactor;
scaled=true;
Tweener.addTween(container_mc,
{_xscale:targetXScale,_yscale:targetYScale, time:0.5,
transition:"easeOut",onComplete:finishTween});
}
var
targetX:Number=Math.round(centerX-currentPic._x*scaleFactor);
var
targetY:Number=Math.round(centerY-currentPic._y*scaleFactor);
Tweener.addTween(container_mc, {_x:targetX, _y:targetY,
time:0.5,
transition:"easeOut",onComplete:finishTween});
}
initPicAction();
setMouseController();
2. I see that objects lay out AFTER swf is resized. How that possible?
I know that stage.onResize function invokes when swf IS RESIZED.
27 декабря 2011 г. 18:30 пользователь Geografiek
<[email protected]> написал:
> At first I thought no, but maybe you do.
> Here's some code I used for zooming
>
> var oldScale:Number; // initial scale of the _dpoToZoom
> var newScale:Number; // target scale of the _dpoToZoom
> var scaleFactor:Number = newScale/oldScale;
> var globalMouse:Point = new Point(stage.mouseX, stage.mouseY);
> var localMouse:Point = _dpoToZoom.parent.globalToLocal(globalMouse);
> var deltaX:Number = localMouse.x - _dpoToZoom.x;
> var deltaY:Number = localMouse.y - _dpoToZoom.y;
> var newX:Number = Math.round((localMouse.x - (deltaX * scaleFactor)));
> var newY:Number = Math.round((localMouse.y - (deltaY * scaleFactor)));
> TweenLite.to(_dpoToZoom, _tweenDuration, {
> scaleX:_currentScale,
> scaleY:_currentScale,
> x:newX,
> y:newY,
> ease:Cubic.easeOut,
> });
>
> HTH
> Willem van den Goorbergh
>
> On 27 dec 2011, at 15:19, natalia Vikhtinskaya wrote:
>
>> Thank you. Should I convert local x.y to Global x,y for clicked mc?
>>
>> 27 декабря 2011 г. 17:02 пользователь Geografiek
>> <[email protected]> написал:
>>> Hi Natalia,
>>> Yes I think that's the general idea. The math is really not that hard.
>>> just scaling (always the same) and moving (relative to the position of the
>>> picture clicked)
>>> Grab paper and pencil and visualize what you want to achieve to get your
>>> calculations started. It really helps.
>>> success
>>> Willem van den Goorbergh
>>>
>>> On 27 dec 2011, at 13:08, natalia Vikhtinskaya wrote:
>>>
>>>> Hi
>>>> I want to create image grid with zoom effect similar to this
>>>> http://www.zara.com/webapp/wcs/stores/servlet/category/us/en/zara-us-W2011-s/149501/
>>>> Click on "event". I need an advice how to place
>>>>
>>>> If I create a grid inside one mainMc how I can manage it? I need to
>>>> zoom this mainMc, move all images but clicked image must be in the
>>>> centre of the screen. Is this correct idea in general? How to make
>>>> calculation? What is the way to solve it?
>>>>
>>>> Thank you for any help.
>>>>
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> [email protected]
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>>
>>>
>>>
>>> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>>> Geografiek is een in Utrecht gevestigd kartografisch bureau
>>> Willem van den Goorbergh is telefonisch bereikbaar onder nummer 030-2719512
>>> of mobiel: 06-26372378
>>> postadres: Hooghiemstraplein 89 3514 AX UTRECHT
>>> Bezoek onze website op: www.geografiek.nl
>>> twitter: @wvdgoorbergh
>>> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
> Geografiek is a Dutch, Utrecht-based map and chart design company.
> Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or
> cell phone: (+31)6-26372378
> visiting address: Hooghiemstraplein 89 3514 AX UTRECHT
> Visit our website at: www.geografiek.nl
> twitter: @wvdgoorbergh
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>
>
>
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders