0 Replies Latest reply on Jan 19, 2012 6:06 PM by andrea1973mi

    The object "Skin" is removed from memory when change orientation of my android device

    andrea1973mi

      Hi,

       

      I have created an application where through the touch screen is possibile to sign a document.

      The application runs both landscape and portrait orientation, but when change the orientation of my device,

      seems that graphics object is removed from device memory.

       

      I tried to resolve this problem by myself but until now I not  still resolved it

       

      I'm looking forward to receiving your reply soon.

      Thanks

      Andrea

       

      Belove, the source code:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

              xmlns:s="library://ns.adobe.com/flex/spark"

              xmlns:model="model.*"

              xmlns:controls="controls.*"

              xmlns:assets="com.pialabs.eskimo.skins.mobile.ios.assets.*"

              xmlns:pia="http://piaction.com"

              accentColor="#FFFFFF" backgroundColor="#feffe0"

               mouseDown="view_mouseDownHandler(event)"

              mouseMove="view_mouseMoveHandler(event)" mouseUp="view_mouseUpHandler(event)"

              title="         サイン入力画面"

              resize="SaveImage()"

               creationComplete="creationCompleteHandler(event)">

          <fx:Declarations>

              <model:SQLiteDAO id="srv"/>

          </fx:Declarations>

          <fx:Metadata>

       

          </fx:Metadata>

          <fx:Script>

              <![CDATA[

       

                  import flash.net.FileReference;

                  import flash.utils.ByteArray;

       

                  import model.*;

       

                  import mx.events.FlexEvent;

                  import mx.events.ResizeEvent;

                  import mx.graphics.codec.JPEGEncoder;

                  import mx.graphics.codec.PNGEncoder;

       

                  import spark.components.Application;

       

                  private var moving:Boolean = false;

                  private var dflg:Boolean = false;

                  private var vectorX:Number = 0;

                  private var vectorY:Number = 0;

       

                  private var oldX:Number;

                  private var oldY:Number;

                  private var stream:FileStream = new FileStream();

       

       

       

       

                 protected function creationCompleteHandler(event:FlexEvent):void

                  {

       

       

                      sprite.graphics.beginFill(0xff0000);

       

                      sprite.graphics.drawRect(0, 0, Capabilities.screenResolutionX, Capabilities.screenResolutionY);

                      sprite.graphics.endFill();

       

       

                  }

       

                  private function SaveImage():void{

                      lblMessage.text += "change";

                      sprite.graphics.beginFill(0xff0000);

                      //    sprite.graphics.lineStyle(1, 0x000000);

                      sprite.graphics.drawRect(0, 0, Capabilities.screenResolutionX, Capabilities.screenResolutionY);

                      sprite.graphics.endFill();

                  }

       

      </fx:Script>

          <s:navigationContent>

              <s:Button id="EndButton" width="100" label="戻 る" click="EndButton_clickHandler(event)"

                        fontSize="24"/>

          </s:navigationContent>

          <s:titleContent>

              <s:VGroup width="100%" height="50%" horizontalAlign="center" verticalAlign="middle">

                  <s:Label color="#FFFFFF" fontSize="24" text="サイン入力画面"/>

              </s:VGroup>

          </s:titleContent>

       

          <s:Button id="ClButton" x="195" y="10" width="115" height="59" label="消去"

                    click="ClButton_clickHandler(event)" fontSize="24"/>

          <s:Label id="lblMessage" x="26" y="81" width="564" height="30" color="#FF0000" fontSize="24"/>

          <s:Button id="SaveButton" x="26" y="10" width="133" height="59" label="保存"

                    click="SaveButton_clickHandler(event)" fontSize="24"/>

              <s:Scroller width="100%" height="100%">

                  <s:SparkSkin id="sprite" left="0" right="0" top="119" bottom="0" accentColor="#FFFFFF"

                               color="#FFFFFF" contentBackgroundColor="#FFFFFF"

                               focusColor="#FFFFFF" mouseDown="view_mouseDownHandler(event)"

                               mouseMove="view_mouseMoveHandler(event)" mouseUp="view_mouseUpHandler(event)"

                               textShadowColor="#FFFFFF" width="100%" resizeMode="scale">

       

                  </s:SparkSkin>

              </s:Scroller>

      </s:View>