Jump to content
Search Community

BlitMask - "End of file was encountered." error

deloki test
Moderator Tag

Recommended Posts

I am getting this weird error trying to use BlitMask when debugging on my android device:

Error #2030: End of file was encountered.

And it is coming from this part of the BlitMask code, on TOUCH_BEGIN event (when i put my finger down on the BlitMasked object):

/** @private **/
protected function _mouseEventPassthrough(event:Event):void {
	if (this.mouseEnabled && (!_bitmapMode || (event is MouseEvent && this.hitTestPoint(MouseEvent(event).stageX, MouseEvent(event).stageY, false)))) {
		dispatchEvent(event);
	}
} 

When debugging in emulator, the error does not happen, only when debugging on device.

 

Does anyone know how to fix this issue?

Link to comment
Share on other sites

To give some more info, the app doesn't break, if i disconnect the debugger before touching the BlitMask, the app will continue to run as it should.

 

Also it seems that the problem happens only when i turn off bitmapMode. 

I think the problem comes from setting cacheAsBitmap to true in an object that i am putting the BlitMask on, and then setting the bitmapMode to false in BlitMask.

When bitmapMode is on in the blitMask, the problem will not appear.

 

It is pretty easy to replicate, if anyone wants to take a look

Link to comment
Share on other sites

  • 4 months later...

Hi,

 

I have the same problem here, did you manage to found a solution ?

I think  the problem i really with BlitMask because when I use MouseEvent instead of TouchEvent (on the exact same project) I don' have any error.

Link to comment
Share on other sites

  • 1 year later...

I'm really not sure what to say - I can't reproduce that problem at all. Can you tell us exactly what steps to take in order to see that problem? Got a sample FLA that's super-simple?

 

Hi... 

 

I found this issue too and I was able to reproduce it... 

 

The only thing you need to reproduce it is:

A Blitmask with bitmapMode = false.

Then touch the Blitmask on the PC, and once you touch the blitmask Adobe AIR crashes, even although I have not added any listener to the blitmask.

I am working on Windows 8.1 x64 TouchScreen PC (Microsoft Surface Pro 1) and Adobe AIR 19.

 

As deloki says, the issue comes from the dispatchEvent(event) line:

/** @private **/
protected function _mouseEventPassthrough(event:Event):void {
    if (this.mouseEnabled && (!_bitmapMode || (event is MouseEvent && this.hitTestPoint(MouseEvent(event).stageX, MouseEvent(event).stageY, false)))) {
        dispatchEvent(event);
    }

You can download the FlashDevelop project showing the issue here:  https://dl.dropboxusercontent.com/u/20568397/Blitmask-Issue.rar

And the deployed version for Windows:  https://dl.dropboxusercontent.com/u/20568397/Blitmask-Issue-captive-runtime.air

 

Here is the code to reprodduce the issue...

package
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	import flash.ui.Multitouch;
	import flash.ui.MultitouchInputMode;
	import flash.events.TouchEvent;
	import flash.events.MouseEvent;
	
	
	import com.greensock.BlitMask;
	/**
	 * ...
	 * @author Diego Diaz
	 */
	
	 
	public class Main extends Sprite 
	{
		
		private var blitmask:BlitMask;
		private var content:MovieClip;
		
		private var blitmask_mode:MovieClip;
		
		
		private var bitmapMode:Boolean = true;
		public function Main() 
		{	
			
			// Enable TouchMode
			Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
			
			// Content to be masked
			content = new EndlessScrollView();
			addChild(content);
			
			
			// Just a button to toggle blitmask BitmapMode
			blitmask_mode = new BlitmaskMode();
			addChild(blitmask_mode);
			blitmask_mode.y = 500;
			blitmask_mode.addEventListener(MouseEvent.CLICK, onClick);
			
			blitmask = new BlitMask(content, 0, 0, 407, 407, false, true, 0, false);	
			
		}
		
		// Toggle BlitMask bitmapMode
		private function onClick(e:MouseEvent):void
		{
			bitmapMode = !bitmapMode;
			bitmapMode?blitmask_mode.gotoAndStop("on"):blitmask_mode.gotoAndStop("off");
			blitmask.bitmapMode = bitmapMode;
		}
	
		
	}
	
}

Hope you can help us to handle this issue.

 

Regards,

Diego

Link to comment
Share on other sites

Sorry to hear about the trouble. Is there something that leads you to believe this is a problem with BlitMask? It sure sounds like an AIR or compiler problem (not sure). The code you pointed to in BlitMask seems entirely legitimate - do you see any problems with it?

 

Frankly, I have zero experience with Flashdevelop and almost zero experience with AIR, but I have heard of plenty of AIR bugs. Makes it tough to troubleshoot. 

Link to comment
Share on other sites

Thanks Jack.. Well it seems you are right... It's most an AIR issue.

Whenever I call dispatchEvent(event), it tries to clone the event before redispatching it. And it crash when trying to clone a touchEvent. I was able to reproduce the issue without using BlitMask, so it's not an BlitMask issue. 

 

Anyway I found a workaround, if someone is having the same issue: Instead of redispath a touch event, just create a new TouchEvent, copy the properties you need and dispatch the new event. 

protected function _mouseEventPassthrough(event:Event):void {
 if (this.mouseEnabled && (!_bitmapMode || (event is MouseEvent && this.hitTestPoint(MouseEvent(event).stageX, MouseEvent(event).stageY, false)))) 
 {
				
  if (hasEventListener(event.type))
  {
	if (event.type.indexOf("touch") != -1)
	{						
		var e:TouchEvent = event as TouchEvent;
		dispatchEvent(new TouchEvent(e.type, e.bubbles, e.cancelable, e.touchPointID));
	}
	else
	{
		dispatchEvent(event);
	}
  }
 }
}
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...