events - Flex - Problem with ResizeEvent.RESIZE -


I have a problem with my resume event ... I have created a component myself, and this component is available on each Change the size of the event, a complex method runs here is the problem: when I maximize or restore my window, this event is sometimes called in real time, to run completely before someone else starts For not giving enough time to my method ... I Anna would like to see if there is any way to run only this method at the end of each resize movement. Thanks

Instead of reacting to a ResizeEvent, which will set fire to every frame during a shape (i.e. If you maximize the hit and take 3 frames for the component to reduce it widh / ehight = 0 to width / height = maxwale) then again the size event will fire three times, you can see the width and height properties Are there. Wid width: ChangeWatcher = ChangeWatcher.watch (this, 'widht', resizeHandler) var heightWatch: ChangeWatcher = ChangeWatcher.watch (this, 'height' resizeHandler)

This will effectively look at the properties of data binding, and when you change the width or height, then your resizing shell will execute. If your width and height change at the same time, then this is a minor shortcoming to fire your handler twice, but it can be solved with a third function, which is brought by your handler, if it Is not included in the schedule. Code:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Mx: application xmlns: mx = "http://www.adobe.com/2006/mxml" layout = "absolute" creation ending = "onCreationComplete (event)" & gt; & Lt; Mx: script & gt; & Lt ;! [CDATA [import mx.binding.utils.ChangeWatcher; Private Vicious WidthWatch: ChangeWater; Private var heightWatch: ChangeWatcher; Private hostile resizeExecuting: boolean = wrong; Private function on Creative Complex (Event: Event): Zero {widthWatch = ChangeWatcher.watch (this, 'width', onSizeChange); HeightWatch = ChangeWatcher.watch (this, 'height', onSizeChange); } Private Function On Size Change (Event: Event): Zero {if (resizeExecuting) callLater (handleResize); ResizeExecuting = true; } Private function handle resize (): zero {// expensive work resizeExecuting = false; } Private Function Stopwalking () {// It closes to see the properties and calls to stop the handleResize method to execute widthWatch.unwatch (); HeightWatch.unwatch (); }] & Gt; & Lt; / Mx: script & gt; & Lt; / Mx: Applications & gt;  

I like the change viewer method because after the width and height properties change, the fire is set, in contrast to the size of a shape, which is the fire before the width and height properties Correclty is updated.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -