Flex Issue : AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Flex Issue : AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

Paul Moreau
Hi folks,

Apologies if this is the wrong place to be posting this kind of thing, Ive
also posted on StackOverflow but thought I'd post here as I know there are
some Flex experts in this forum and haven't had huge feedback on
StackOverflow on Flex/AIR issues in the past.

AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

*Problem:*

Zooming in on image by scaling and moving using matrix causes the app to
run out of memory and crash.

*Additional Libraries used:*

Gestouch - https://github.com/fljot/Gestouch

*Description:*

In my Flex Mobile app I have an Image inside a Group with pan/zoom enabled
using the Gestouch library. The zoom works to an extent but causes the app
to die (not freeze, just exit) with no error message after a certain zoom
level.

This would be managable except I can’t figure out how to implement a
threshold to stop the zoom at, as it crashes at a different zoom level
almost every time. I also use dynamic images so the source of the image
could be any size or resolution.

They are usually JPEGS ranging from about 800x600 - 9000x6000.

As of the AS3 docs there is no longer a limit to the size of the BitmapData
object so that shouldn't be the issue.

“Starting with AIR 3 and Flash player 11, the size limits for a BitmapData
object have been removed. The maximum size of a bitmap is now dependent on
the operating system.”

The crash mainly happens on iPad Mini and older Android devices.


*Things I have tried already tried:*

Using Adobe Scout to pin point when the memory leak occurs.

Debugging to find the exact height and width of the marker layer and image
at the time of crash.

Setting a max zoom variable based on the size of the image.

Cropping the image on zoom to only show the visible area. ( crashes on
copyPixels  function and BitmapData.draw() function )

Using imagemagick to make lower quality images ( small images still crash )

Using imagemagick to make  very low res image and make a grid of smaller
images . Displaying in the mobile app using a List and Tile layout.


Any suggestions would be appreciated.


Thanks,


Paul

--






*DISCLAIMER: This electronic message together with any attachments is
confidential. If you are not the intended recipient, do not copy, disclose
or use the contents in any way. Please also advise us by return e-mail that
you have received the message and then please destroy. Zutec  Ltd is not
responsible for any changes made to this message and / or any attachments
after sending by Zutec. We use virus scanning software but exclude all
liability for viruses or anything similar in this email or any attachment.*
Reply | Threaded
Open this post in threaded view
|

Re: Flex Issue : AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

clintm
My immediate reaction whenever I hear memory problems with images is
somewhere some code is forgetting to call bitmapdata.dispose() before a
bitmapdata object is discarded.

In situations like this Adobe Scout is your friend.
https://www.adobe.com/products/scout.html
It let's your profile memory (and other things). Although I think you need
to compile it with Flash Builder 4.7 so you can use the advanced telemetry
compiler option.  Although I'm not sure that's required either to do memory
profiling.

On Thu, May 26, 2016 at 9:14 AM, Paul Moreau <[hidden email]> wrote:

> Hi folks,
>
> Apologies if this is the wrong place to be posting this kind of thing, Ive
> also posted on StackOverflow but thought I'd post here as I know there are
> some Flex experts in this forum and haven't had huge feedback on
> StackOverflow on Flex/AIR issues in the past.
>
> AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE
>
> *Problem:*
>
> Zooming in on image by scaling and moving using matrix causes the app to
> run out of memory and crash.
>
> *Additional Libraries used:*
>
> Gestouch - https://github.com/fljot/Gestouch
>
> *Description:*
>
> In my Flex Mobile app I have an Image inside a Group with pan/zoom enabled
> using the Gestouch library. The zoom works to an extent but causes the app
> to die (not freeze, just exit) with no error message after a certain zoom
> level.
>
> This would be managable except I can’t figure out how to implement a
> threshold to stop the zoom at, as it crashes at a different zoom level
> almost every time. I also use dynamic images so the source of the image
> could be any size or resolution.
>
> They are usually JPEGS ranging from about 800x600 - 9000x6000.
>
> As of the AS3 docs there is no longer a limit to the size of the BitmapData
> object so that shouldn't be the issue.
>
> “Starting with AIR 3 and Flash player 11, the size limits for a BitmapData
> object have been removed. The maximum size of a bitmap is now dependent on
> the operating system.”
>
> The crash mainly happens on iPad Mini and older Android devices.
>
>
> *Things I have tried already tried:*
>
> Using Adobe Scout to pin point when the memory leak occurs.
>
> Debugging to find the exact height and width of the marker layer and image
> at the time of crash.
>
> Setting a max zoom variable based on the size of the image.
>
> Cropping the image on zoom to only show the visible area. ( crashes on
> copyPixels  function and BitmapData.draw() function )
>
> Using imagemagick to make lower quality images ( small images still crash )
>
> Using imagemagick to make  very low res image and make a grid of smaller
> images . Displaying in the mobile app using a List and Tile layout.
>
>
> Any suggestions would be appreciated.
>
>
> Thanks,
>
>
> Paul
>
> --
>
>
>
>
>
>
> *DISCLAIMER: This electronic message together with any attachments is
> confidential. If you are not the intended recipient, do not copy, disclose
> or use the contents in any way. Please also advise us by return e-mail that
> you have received the message and then please destroy. Zutec  Ltd is not
> responsible for any changes made to this message and / or any attachments
> after sending by Zutec. We use virus scanning software but exclude all
> liability for viruses or anything similar in this email or any attachment.*
>
Reply | Threaded
Open this post in threaded view
|

Re: Flex Issue : AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

Paul Moreau
Thanks for the reply Clint but the crash happens while the user is zooming
on the image, so I cannot call the dispose function as the image needs to
remain onscreen while the user pan zooms.

Paul

On Thu, May 26, 2016 at 5:40 PM, Clint M <[hidden email]> wrote:

> My immediate reaction whenever I hear memory problems with images is
> somewhere some code is forgetting to call bitmapdata.dispose() before a
> bitmapdata object is discarded.
>
> In situations like this Adobe Scout is your friend.
> https://www.adobe.com/products/scout.html
> It let's your profile memory (and other things). Although I think you need
> to compile it with Flash Builder 4.7 so you can use the advanced telemetry
> compiler option.  Although I'm not sure that's required either to do memory
> profiling.
>
> On Thu, May 26, 2016 at 9:14 AM, Paul Moreau <[hidden email]>
> wrote:
>
> > Hi folks,
> >
> > Apologies if this is the wrong place to be posting this kind of thing,
> Ive
> > also posted on StackOverflow but thought I'd post here as I know there
> are
> > some Flex experts in this forum and haven't had huge feedback on
> > StackOverflow on Flex/AIR issues in the past.
> >
> > AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE
> >
> > *Problem:*
> >
> > Zooming in on image by scaling and moving using matrix causes the app to
> > run out of memory and crash.
> >
> > *Additional Libraries used:*
> >
> > Gestouch - https://github.com/fljot/Gestouch
> >
> > *Description:*
> >
> > In my Flex Mobile app I have an Image inside a Group with pan/zoom
> enabled
> > using the Gestouch library. The zoom works to an extent but causes the
> app
> > to die (not freeze, just exit) with no error message after a certain zoom
> > level.
> >
> > This would be managable except I can’t figure out how to implement a
> > threshold to stop the zoom at, as it crashes at a different zoom level
> > almost every time. I also use dynamic images so the source of the image
> > could be any size or resolution.
> >
> > They are usually JPEGS ranging from about 800x600 - 9000x6000.
> >
> > As of the AS3 docs there is no longer a limit to the size of the
> BitmapData
> > object so that shouldn't be the issue.
> >
> > “Starting with AIR 3 and Flash player 11, the size limits for a
> BitmapData
> > object have been removed. The maximum size of a bitmap is now dependent
> on
> > the operating system.”
> >
> > The crash mainly happens on iPad Mini and older Android devices.
> >
> >
> > *Things I have tried already tried:*
> >
> > Using Adobe Scout to pin point when the memory leak occurs.
> >
> > Debugging to find the exact height and width of the marker layer and
> image
> > at the time of crash.
> >
> > Setting a max zoom variable based on the size of the image.
> >
> > Cropping the image on zoom to only show the visible area. ( crashes on
> > copyPixels  function and BitmapData.draw() function )
> >
> > Using imagemagick to make lower quality images ( small images still
> crash )
> >
> > Using imagemagick to make  very low res image and make a grid of smaller
> > images . Displaying in the mobile app using a List and Tile layout.
> >
> >
> > Any suggestions would be appreciated.
> >
> >
> > Thanks,
> >
> >
> > Paul
> >
> > --
> >
> >
> >
> >
> >
> >
> > *DISCLAIMER: This electronic message together with any attachments is
> > confidential. If you are not the intended recipient, do not copy,
> disclose
> > or use the contents in any way. Please also advise us by return e-mail
> that
> > you have received the message and then please destroy. Zutec  Ltd is not
> > responsible for any changes made to this message and / or any attachments
> > after sending by Zutec. We use virus scanning software but exclude all
> > liability for viruses or anything similar in this email or any
> attachment.*
> >
>



--






*DISCLAIMER: This electronic message together with any attachments is
confidential. If you are not the intended recipient, do not copy, disclose
or use the contents in any way. Please also advise us by return e-mail that
you have received the message and then please destroy. Zutec  Ltd is not
responsible for any changes made to this message and / or any attachments
after sending by Zutec. We use virus scanning software but exclude all
liability for viruses or anything similar in this email or any attachment.*
Reply | Threaded
Open this post in threaded view
|

Re: Flex Issue : AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

clintm
Hmmm... if it just crashes you might be hitting the max bitmap data size of
the operating system that the app is running on.

"Starting with AIR 3 and Flash player 11, the size limits for a BitmapData
object have been removed. The maximum size of a bitmap is now dependent on
the operating system."
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html

On Tue, May 31, 2016 at 6:42 AM, Paul Moreau <[hidden email]> wrote:

> Thanks for the reply Clint but the crash happens while the user is zooming
> on the image, so I cannot call the dispose function as the image needs to
> remain onscreen while the user pan zooms.
>
> Paul
>
> On Thu, May 26, 2016 at 5:40 PM, Clint M <[hidden email]> wrote:
>
> > My immediate reaction whenever I hear memory problems with images is
> > somewhere some code is forgetting to call bitmapdata.dispose() before a
> > bitmapdata object is discarded.
> >
> > In situations like this Adobe Scout is your friend.
> > https://www.adobe.com/products/scout.html
> > It let's your profile memory (and other things). Although I think you
> need
> > to compile it with Flash Builder 4.7 so you can use the advanced
> telemetry
> > compiler option.  Although I'm not sure that's required either to do
> memory
> > profiling.
> >
> > On Thu, May 26, 2016 at 9:14 AM, Paul Moreau <[hidden email]>
> > wrote:
> >
> > > Hi folks,
> > >
> > > Apologies if this is the wrong place to be posting this kind of thing,
> > Ive
> > > also posted on StackOverflow but thought I'd post here as I know there
> > are
> > > some Flex experts in this forum and haven't had huge feedback on
> > > StackOverflow on Flex/AIR issues in the past.
> > >
> > > AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE
> > >
> > > *Problem:*
> > >
> > > Zooming in on image by scaling and moving using matrix causes the app
> to
> > > run out of memory and crash.
> > >
> > > *Additional Libraries used:*
> > >
> > > Gestouch - https://github.com/fljot/Gestouch
> > >
> > > *Description:*
> > >
> > > In my Flex Mobile app I have an Image inside a Group with pan/zoom
> > enabled
> > > using the Gestouch library. The zoom works to an extent but causes the
> > app
> > > to die (not freeze, just exit) with no error message after a certain
> zoom
> > > level.
> > >
> > > This would be managable except I can’t figure out how to implement a
> > > threshold to stop the zoom at, as it crashes at a different zoom level
> > > almost every time. I also use dynamic images so the source of the image
> > > could be any size or resolution.
> > >
> > > They are usually JPEGS ranging from about 800x600 - 9000x6000.
> > >
> > > As of the AS3 docs there is no longer a limit to the size of the
> > BitmapData
> > > object so that shouldn't be the issue.
> > >
> > > “Starting with AIR 3 and Flash player 11, the size limits for a
> > BitmapData
> > > object have been removed. The maximum size of a bitmap is now dependent
> > on
> > > the operating system.”
> > >
> > > The crash mainly happens on iPad Mini and older Android devices.
> > >
> > >
> > > *Things I have tried already tried:*
> > >
> > > Using Adobe Scout to pin point when the memory leak occurs.
> > >
> > > Debugging to find the exact height and width of the marker layer and
> > image
> > > at the time of crash.
> > >
> > > Setting a max zoom variable based on the size of the image.
> > >
> > > Cropping the image on zoom to only show the visible area. ( crashes on
> > > copyPixels  function and BitmapData.draw() function )
> > >
> > > Using imagemagick to make lower quality images ( small images still
> > crash )
> > >
> > > Using imagemagick to make  very low res image and make a grid of
> smaller
> > > images . Displaying in the mobile app using a List and Tile layout.
> > >
> > >
> > > Any suggestions would be appreciated.
> > >
> > >
> > > Thanks,
> > >
> > >
> > > Paul
> > >
> > > --
> > >
> > >
> > >
> > >
> > >
> > >
> > > *DISCLAIMER: This electronic message together with any attachments is
> > > confidential. If you are not the intended recipient, do not copy,
> > disclose
> > > or use the contents in any way. Please also advise us by return e-mail
> > that
> > > you have received the message and then please destroy. Zutec  Ltd is
> not
> > > responsible for any changes made to this message and / or any
> attachments
> > > after sending by Zutec. We use virus scanning software but exclude all
> > > liability for viruses or anything similar in this email or any
> > attachment.*
> > >
> >
>
>
>
> --
>
>
>
>
>
>
> *DISCLAIMER: This electronic message together with any attachments is
> confidential. If you are not the intended recipient, do not copy, disclose
> or use the contents in any way. Please also advise us by return e-mail that
> you have received the message and then please destroy. Zutec  Ltd is not
> responsible for any changes made to this message and / or any attachments
> after sending by Zutec. We use virus scanning software but exclude all
> liability for viruses or anything similar in this email or any attachment.*
>
Reply | Threaded
Open this post in threaded view
|

Re: Flex Issue : AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE

Mihai Chira
Paul, did you end up making any progress on this? I'd love to know if there
was any improvement you could find.

On Tue, May 31, 2016 at 6:13 PM Clint M <[hidden email]> wrote:

> Hmmm... if it just crashes you might be hitting the max bitmap data size of
> the operating system that the app is running on.
>
> "Starting with AIR 3 and Flash player 11, the size limits for a BitmapData
> object have been removed. The maximum size of a bitmap is now dependent on
> the operating system."
>
> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html
>
> On Tue, May 31, 2016 at 6:42 AM, Paul Moreau <[hidden email]>
> wrote:
>
> > Thanks for the reply Clint but the crash happens while the user is
> zooming
> > on the image, so I cannot call the dispose function as the image needs to
> > remain onscreen while the user pan zooms.
> >
> > Paul
> >
> > On Thu, May 26, 2016 at 5:40 PM, Clint M <[hidden email]> wrote:
> >
> > > My immediate reaction whenever I hear memory problems with images is
> > > somewhere some code is forgetting to call bitmapdata.dispose() before a
> > > bitmapdata object is discarded.
> > >
> > > In situations like this Adobe Scout is your friend.
> > > https://www.adobe.com/products/scout.html
> > > It let's your profile memory (and other things). Although I think you
> > need
> > > to compile it with Flash Builder 4.7 so you can use the advanced
> > telemetry
> > > compiler option.  Although I'm not sure that's required either to do
> > memory
> > > profiling.
> > >
> > > On Thu, May 26, 2016 at 9:14 AM, Paul Moreau <[hidden email]>
> > > wrote:
> > >
> > > > Hi folks,
> > > >
> > > > Apologies if this is the wrong place to be posting this kind of
> thing,
> > > Ive
> > > > also posted on StackOverflow but thought I'd post here as I know
> there
> > > are
> > > > some Flex experts in this forum and haven't had huge feedback on
> > > > StackOverflow on Flex/AIR issues in the past.
> > > >
> > > > AS3 FLEX MOBILE APP CRASHING WHEN SCALING IMAGE
> > > >
> > > > *Problem:*
> > > >
> > > > Zooming in on image by scaling and moving using matrix causes the app
> > to
> > > > run out of memory and crash.
> > > >
> > > > *Additional Libraries used:*
> > > >
> > > > Gestouch - https://github.com/fljot/Gestouch
> > > >
> > > > *Description:*
> > > >
> > > > In my Flex Mobile app I have an Image inside a Group with pan/zoom
> > > enabled
> > > > using the Gestouch library. The zoom works to an extent but causes
> the
> > > app
> > > > to die (not freeze, just exit) with no error message after a certain
> > zoom
> > > > level.
> > > >
> > > > This would be managable except I can’t figure out how to implement a
> > > > threshold to stop the zoom at, as it crashes at a different zoom
> level
> > > > almost every time. I also use dynamic images so the source of the
> image
> > > > could be any size or resolution.
> > > >
> > > > They are usually JPEGS ranging from about 800x600 - 9000x6000.
> > > >
> > > > As of the AS3 docs there is no longer a limit to the size of the
> > > BitmapData
> > > > object so that shouldn't be the issue.
> > > >
> > > > “Starting with AIR 3 and Flash player 11, the size limits for a
> > > BitmapData
> > > > object have been removed. The maximum size of a bitmap is now
> dependent
> > > on
> > > > the operating system.”
> > > >
> > > > The crash mainly happens on iPad Mini and older Android devices.
> > > >
> > > >
> > > > *Things I have tried already tried:*
> > > >
> > > > Using Adobe Scout to pin point when the memory leak occurs.
> > > >
> > > > Debugging to find the exact height and width of the marker layer and
> > > image
> > > > at the time of crash.
> > > >
> > > > Setting a max zoom variable based on the size of the image.
> > > >
> > > > Cropping the image on zoom to only show the visible area. ( crashes
> on
> > > > copyPixels  function and BitmapData.draw() function )
> > > >
> > > > Using imagemagick to make lower quality images ( small images still
> > > crash )
> > > >
> > > > Using imagemagick to make  very low res image and make a grid of
> > smaller
> > > > images . Displaying in the mobile app using a List and Tile layout.
> > > >
> > > >
> > > > Any suggestions would be appreciated.
> > > >
> > > >
> > > > Thanks,
> > > >
> > > >
> > > > Paul
> > > >
> > > > --
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > *DISCLAIMER: This electronic message together with any attachments is
> > > > confidential. If you are not the intended recipient, do not copy,
> > > disclose
> > > > or use the contents in any way. Please also advise us by return
> e-mail
> > > that
> > > > you have received the message and then please destroy. Zutec  Ltd is
> > not
> > > > responsible for any changes made to this message and / or any
> > attachments
> > > > after sending by Zutec. We use virus scanning software but exclude
> all
> > > > liability for viruses or anything similar in this email or any
> > > attachment.*
> > > >
> > >
> >
> >
> >
> > --
> >
> >
> >
> >
> >
> >
> > *DISCLAIMER: This electronic message together with any attachments is
> > confidential. If you are not the intended recipient, do not copy,
> disclose
> > or use the contents in any way. Please also advise us by return e-mail
> that
> > you have received the message and then please destroy. Zutec  Ltd is not
> > responsible for any changes made to this message and / or any attachments
> > after sending by Zutec. We use virus scanning software but exclude all
> > liability for viruses or anything similar in this email or any
> attachment.*
> >
>