bitmap as mask
i have few imported images in library i'd use mask fit on video can't work. here's how works far. imported image photoshop .psd transparent layers.
import flash.display.sprite;
import flash.media.video;
import flash.display.movieclip;
public class main extends sprite {
public function main() {
private var video:video = new video();
private var dot:movieclip = new symbol1();
video.width = 160;
video.height = 90;
video.x = 443; //video position
video.y = 190;
addchild(video); //add video stage
dot.x = video.x;
dot.y = video.y;
addchild(dot);
video.mask = dot;
}
}
this doesn't work. video gets masked whole image, , not shape trasparent layer.
so figure i'd have convert psd bitmap, cause sounds can use bitmaps. draged psd image flash bitmapdata file in library. still doesn't work. here's new code:
private var dot:bitmapdata = new bitmap6;
public function main {
video.x = 443; //video position
video.y = 190;
addchild(video); //add video stage
dot.x = video.x;
dot.y = video.y;
addchild(dot);
video.mask = dot;
}
but these compiler errors:
| 1119: access of possibly undefined property x through reference static type flash.display:bitmapdata. | |
| 1119: access of possibly undefined property y through reference static type flash.display:bitmapdata. | |
| 1067: implicit coercion of value of type flash.display:bitmapdata unrelated type flash.display:displayobject. | |
| 1067: implicit coercion of value of type flash.display:bitmapdata unrelated type flash.display:displayobject. |
so i'm not sure do. can me out?
thanks, if can help.
nevermind, totally figured out on own. image needs imported png or bitmap. then:
public class main extends sprite {
public function main() {
private var video:video = new video();
private var dot:bitmapdata = new symbol1();
private var mymask:bitmap = new bitmap(dot);
video.width = 160;
video.height = 90;
video.x = 443; //video position
video.y = 190;
addchild(video); //add video stage
video.cacheasbitmap = true; // pretty important
mymask.cacheasbitmap = true;
mymask.x = video.x;
mymask.y = video.y;
addchild(mymask);
video.mask = mymask;
}
}
well... anyway anyone.
More discussions in ActionScript 3
adobe
Comments
Post a Comment