Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 114192

Re: AIR 15 crash using readGraphicsData()

$
0
0

We have tried to reproduce the issue using below code:

 

package

{

  import flash.display.GraphicsPathCommand;

  import flash.display.IGraphicsData;

  import flash.display.Shape;

  import flash.display.Sprite;

  import flash.events.MouseEvent;

 

  public class ReadGraphicsDataExample extends Sprite

  {

  private var original:Shape;

  private var copy:Shape;

 

  public function ReadGraphicsDataExample()

  {

  original = new Shape();

  original.x = 50;

  original.y = 100;

  addChild(original);

 

  drawSquare();

 

  copy = new Shape();

  copy.x = 250;

  copy.y = 100;

  addChild(copy);

 

  stage.addEventListener(MouseEvent.CLICK, drawCopyOnClick);

  }

 

  private function drawCopyOnClick(event:MouseEvent):void

  {

  copy.graphics.clear();

  var xPos:Number = original.x;

  var yPos:Number = original.y;

  original.x = 0;

  original.y = 0;

  var result:Vector.<IGraphicsData> = original.graphics.readGraphicsData(false);

  original.x = xPos;

  original.y = yPos;

   // re-draw

  copy.graphics.drawGraphicsData(result);

  }

 

  private function drawSquare():void

  {

  var squareCommands:Vector.<int> = new Vector.<int>(5, true);

 

  squareCommands[0] = GraphicsPathCommand.MOVE_TO;

  squareCommands[1] = GraphicsPathCommand.LINE_TO;

  squareCommands[2] = GraphicsPathCommand.LINE_TO;

  squareCommands[3] = GraphicsPathCommand.LINE_TO;

 

  var squareCoordinates:Vector.<Number> = new Vector.<Number>(8, true);

  squareCoordinates[0] = 0;

  squareCoordinates[1] = 0;

  squareCoordinates[2] = 50;

  squareCoordinates[3] = 0;

  squareCoordinates[4] = 50;

  squareCoordinates[5] = 50;

  squareCoordinates[6] = 0;

  squareCoordinates[7] = 50;

 

  original.graphics.beginFill(0x003366);

  original.graphics.drawPath(squareCommands, squareCoordinates);

  }

  }

}

 

 

When I click on square, it easily read data from graphics and produce the same square.

 

I am not able to reproduce the issue as no crash happen.

 

Could you please provide a sample app or code so that we can easily figure out the cause for same.

 

-Pravendra


Viewing all articles
Browse latest Browse all 114192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>