flash - Get Notified of Change in Flex Bitmap or BitmapData? -
in flex, how 1 hook bitmap or bitmapdata variable function notified whenever bitmap's data has changed (pixel has changed, or filter's been added)?
i tried setting binding doesn't work.
there must way it, because can bind mx:image bitmap via 'source' attribute, , displayed image updates time when modify bitmap. how flex it? blindly redraw bitmap @ every frame, or smart , redraws when bitmap changes? if so, how know when bitmap changes?
this sort of semi-educated guess, no testing behind it, take salt.
when flex binds source attribute of image
, value of .source
of type bitmapasset
.
bitmapasset
has .bitmapdata
property, reference bitmap in question.
i expect binding done flex against .bitmapdata
property.
i don't see reason why shouldn't able that, too. think you'd have little circular work, though, you'd have create bitmapasset
instance , populate bitmapdata
want keep tabs on, bind .bitmapdata
property of bitmapasset
object.
assuming var called 'bitmapdata', instance of bitmapdata
, think following should work.
var bitmapasset:bitmapasset = new bitmapasset(bitmapdata); var bitmapdatachangewatcher:changewatcher = bindingutils.bindsetter(handlechangetobitmapdata, bitmapasset, "bitmapdata"); private function handlechangetobitmapdata(data:bitmapdata):void { // handle change bitmap data }
Comments
Post a Comment