Using DistortImage with dynamically loaded images

About a week ago someone asked me through the comments-section of a previous post if it was possible to use the DistortImage class with non-embedded (runtime-loaded) images.

Here’s an example:
DistortImage dynamic loading demo
DistortImage dynamic loading demo source

NOTE: I wrote that the code added to the mxml-file in a bit of a rush, it is by no means an example of best practices or what properly written code should look like. Forgive me ;)

In the source-code (dynamic.mxml) I put some extra comments in an attempt to clarify where this code differs from that in the mxml-file of the original demo.

As you can see most of the new lines of code are spent on actually loading the external bitmap, only two of the last lines of Actionscript (where it says “fetch BitmapData”) are essential to the preparation of the bitmap-data.

No Responses

Note that comments are displayed in reverse chronological order with topmost comments being freshest. Subscribe | Comment

Leave a Reply