Yes, timer does this magc! Thank you Karim! Thank you Cédric also.
Maybe you can give me better idea for calculation when I calculate
picture size and column numbers on the start. I want it be in width
from 180 to 225. Column number should depends on stage width and I
will calculate it after resizing has finished but I can not find good
logic formula for that.
I know it is not good gode
var startPicW:Number=180; / /in the beginning I use this
var startPicH:Number=120;
function initPic():void {
var p:Number=startPicW/startPicH;
maxCol=Math.round(stage.stageWidth/startPicW)
var diff:Number=stage.stageWidth-startPicW*maxCol;
if (diff<0){
maxCol-=1;
}
diff=stage.stageWidth - startPicW*maxCol;
startPicW+=Math.round(diff/maxCol)
startPicH=startPicW/p;
.....
}
3 января 2012 г. 18:30 пользователь Cédric Muller <[email protected]> написал:
> just use a timer (as Karim pointed out)
> or compare the previous values (stageWidth and stageHeight) with the current
> ones: if both are equal you could fire your resize code
> or you could, ultimately, resize your application each time resize is called
> too (depending on how you are handling your resize code, this could work)
>
>> Maybe I don't understand your idea.
>> I checked
>> stage.addEventListener(Event.RESIZE, resizeHandler);
>> function resizeHandler(e:Event=null):void {
>> trace("stage "+stage.stageWidth)
>> }
>>
>> That gives me
>> stage 999
>> stage 967
>> stage 911
>> stage 835
>> stage 790
>> stage 745
>> stage 705
>> stage 679
>> stage 674
>> stage 673
>> I need to do something only once after the last changes where stage is 673.
>> How Resize Event can help in this situation?
>>
>>
>>
>>
>>
>> 3 января 2012 г. 16:46 пользователь Cédric Muller <[email protected]>
>> написал:
>>> or you could setup a CustomEvent.RESIZED thing that you throw when your
>>> resize code has been executed ... but you could also be ok by just calling
>>> a method /after/ the resize code/loop
>>>
>>> private function resizeHandler (e:Event):void {
>>> // resize code here (could be long)
>>> // resize code here
>>> // end of resize code/loop, now we dispatch a RESIZED event
>>> var ce:CustomEvent = new CustomEvent(CustomEvent.RESIZED);
>>> dispatchEvent(ce);
>>> }
>>>
>>> (your class needs to somewhat extend flash.events.EventDispatcher)
>>>
>>>> Or, if you really need to, you can do something like this:
>>>>
>>>> import flash.utils.setTimeout;
>>>> import flash.utils.clearTimeout;
>>>>
>>>> var timeOutID : uint;
>>>> stage.addEventListener(Event.RESIZE, resizeHandler, false, 0, true)
>>>>
>>>> function resizeHandler( e : Event = null ) : void {
>>>>
>>>> clearTimeout( timeOutID ) ;
>>>> timeOutID = setTimeout( resizeIsComplete , 250 );
>>>>
>>>> }
>>>>
>>>> function resizeIsComplete() : void {
>>>> trace('resizeIsComplete');
>>>> }
>>>>
>>>>
>>>>
>>>> On 3 Jan 2012, at 08:05, Cédric Muller wrote:
>>>>
>>>>> Yes, I know, but I interpreted what was needed, and I /think/ RESIZE does
>>>>> the job:
>>>>>
>>>>> RESIZE occurs
>>>>> your 'resize' code is executed
>>>>> when your code has been executed, it is RESIZEd.
>>>>>
>>>>> :) Ok, ok, I know
>>>>>
>>>>>> Cédric Muller skriver:
>>>>>>> stage.addEventListener(Event.RESIZE, resizeHandler, false, 0, true)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Is it possible to get information in swf from a browser that resizing
>>>>>>>> process is finished?
>>>>>>>>
>>>>>>
>>>>>> Sorry, but that event is not for when the resizing has finished. It is
>>>>>> when it is happening.
>>>>>>
>>>>>> _______________________________________________
>>>>>> Flashcoders mailing list
>>>>>> [email protected]
>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Flashcoders mailing list
>>>>> [email protected]
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>
>>>>
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> [email protected]
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>
>>>
>>> _______________________________________________
>>> Flashcoders mailing list
>>> [email protected]
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders