(Update: Found it working fine on android phone. But shows problem on pc/mac )
Simple scratch card type code. Makes use of masked layer.
That reveals the movieclip beneath when lines are drawn over the mask movieclip.
This worked without issues in previous versions. But now it does not work properly now
The problem now is that it reveals and covers up back.
With Mask:
Without mask:
package myapp;
import flash.Lib;
import openfl.events.*;
import openfl.Assets;
import flash.text.*;
import openfl.Assets;
import openfl.display.*;
import openfl.geom.Point;
import openfl.utils.Function;
class Main extends Sprite
{
public var appContainer_Mc: MovieClip;
public var mc: MovieClip;
public function new() {
super();
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
function addedToStage(e:Event):Void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
loadMain();
}
private function loadMain(): Void
{
appContainer_Mc =Assets.getMovieClip("library:FishObject");
var fishWithCut_Mc:MovieClip = cast(appContainer_Mc.getChildByName("fishWithCut_Mc"),MovieClip);
var fish_Mc:MovieClip = cast(appContainer_Mc.getChildByName("fish_Mc"),MovieClip);
mc = new MovieClip() ;
appContainer_Mc.addChild(mc);
mc.graphics.lineStyle(8, 255 ,1);
mc.graphics.moveTo(mc.x, mc.y);
fishWithCut_Mc.mask = mc ;
addChild(appContainer_Mc);
addEventListener(Event.ENTER_FRAME, ef);
}
public function ef(e:Event ) :Void
{
mc.graphics.lineTo(mouseX, mouseY);
}
}