Bitmap as mask

I have a few imported images in my library I'd like to use as a mask to fit over a video but I can't get it to work. Here's how it works so far. The imported image is a photoshop .psd with some 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 to stage
     dot.x = video.x;
     dot.y = video.y;
     addChild(dot);
     video.mask = dot;
This doesn't work. The video just gets masked by the whole image, and not the shape with the trasparent layer.
So I figure I'd have to convert the psd to a bitmap, cause it sounds like you can only use bitmaps. So I just draged the psd image into flash to get a bitmapdata file in my library. But it still doesn't work. Here's the new code:
private var dot:BitmapData = new Bitmap6;
public function main {
          video.x = 443; //Video position
                                        video.y = 190;
                                        addChild(video); //Add video to stage
                                        dot.x = video.x;
                                        dot.y = video.y;
                                        addChild(dot);
                                        video.mask = dot;
but now I get these compiler errors:
1119: Access of possibly undefined property x through a reference with static type flash.display:BitmapData.
1119: Access of possibly undefined property y through a reference with static type flash.display:BitmapData.
1067: Implicit coercion of a value of type flash.display:BitmapData to an unrelated type flash.display:DisplayObject.
1067: Implicit coercion of a value of type flash.display:BitmapData to an unrelated type flash.display:DisplayObject.
So now I'm not sure what to do. Can anybody help me out?
Thanks, if anyone can help.

Nevermind, totally figured it out on my own. The image needs to be imported as a png or as a 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 to stage
            video.cacheAsBitmap = true;  // this is pretty important
            mymask.cacheAsBitmap = true;
     mymask.x = video.x;
     mymask.y = video.y;
     addChild(mymask);
     video.mask = mymask;
Well... thanks anyway to anyone.

Similar Messages

  • Complex-shaped-bitmap as mask?

    Is it possible to use a complex bitmap shape as a mask? If
    so, how? I've got a .png but the mask honors the square edge of the
    image rather than the silhouette

    Nevermind, totally figured it out on my own. The image needs to be imported as a png or as a 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 to stage
                video.cacheAsBitmap = true;  // this is pretty important
                mymask.cacheAsBitmap = true;
         mymask.x = video.x;
         mymask.y = video.y;
         addChild(mymask);
         video.mask = mymask;
    Well... thanks anyway to anyone.

  • Alpha Mask Limit?

    Hello, I recently just had a long problem that I could not
    figure out. I couldn't get a particular image to take an alpha
    blended mask. Since I've been able to successfully do this
    countless times prior (through both the timeline and AS), I wasn't
    able to find the reason why this particular image wouldn't accept
    it. Naturally, I went insane. If I had runtime caching checked, I
    would get no masking at all. If I had it unchecked, I would get a
    solid mask.
    I've narrowed the issue down to one factor and one factor
    alone, the physical size of the image. It doesn't matter the file
    size of the image being used, rather its dimensions in relation to
    the stage. Shrinking the image worked, blowing up any other image
    (as a test) makes it stop working again.
    My question is this: What's the largest size image we can
    alpha mask? Mine was 1608x259(original) and I was trying to scroll
    it across a 705x504 size stage. I didn't keep sizing down until it
    worked, rather I just cut it up at its current size, so I don't
    know yet this limit, but it's there.

    300thnickattempt wrote:
    > Hello, I recently just had a long problem that I could
    not figure out. I
    > couldn't get a particular image to take an alpha blended
    mask. Since I've been
    > able to successfully do this countless times prior
    (through both the timeline
    > and AS), I wasn't able to find the reason why this
    particular image wouldn't
    > accept it. Naturally, I went insane. If I had runtime
    caching checked, I would
    > get no masking at all. If I had it unchecked, I would
    get a solid mask.
    >
    > I've narrowed the issue down to one factor and one
    factor alone, the physical
    > size of the image. It doesn't matter the file size of
    the image being used,
    > rather its dimensions in relation to the stage.
    Shrinking the image worked,
    > blowing up any other image (as a test) makes it stop
    working again.
    >
    > My question is this: What's the largest size image we
    can alpha mask? Mine was
    > 1608x259(original) and I was trying to scroll it across
    a 705x504 size stage. I
    > didn't keep sizing down until it worked, rather I just
    cut it up at its current
    > size, so I don't know yet this limit, but it's there.
    >
    I could not reproduce the problem. For test I imported 2000
    by 700 pixels image.
    Set caching bitmap and mask using setMask action, animated
    the mask, animate the image
    and than the both in the same time.
    Variety of combinations, each time it work w/o problem.
    My guess is the file get somehow corrupted. FLA are very
    delicate and its common to
    experience unusually behaviors for no apparent reason.
    Try to do the same in new file see if happens again. Try to
    adjust the dimensions, make
    the image slightly bigger or smaller. Remove the image from
    stage, drag it from library
    to stage again and convert it to an instance movie clip.
    Sometimes the link between
    library content and stage get messed up.
    Regards
    Urami
    Happy New Year guys - all the best there is in the 2006 :)
    <urami>
    http://www.Flashfugitive.com
    </urami>
    <web junk free>
    http://www.firefox.com
    </web junk free>

  • Masking multiple layers with one mask

    Is there any way to do this???
    When I setup template files for say...  thumbnail images  with rounded corners and a dropshadow, I preffer to do this the way that Photshop and imagready allow you to do it > creat a shape and use it to mask whichever layers above it. That way if I choose to make it one or two pixels wider, I just do it to the masking layer and resave the tumbnails out. As far as I can tell Fireworks makes you create a different mask for every layer so you would have to change it in every layer... not the best work flow!
    Thanks for any help with this.

    " Hmm...could  something like this be done using an animation, then export the  animation to images?"
    My imagination doesn't lead me to a solution using the animation features. How about a custom Command that creates an instant mask with shadow? Let's say I've got a stack of Bitmaps sitting on the canvas. I hide all but the one on top, and then draw a shape I want to mask them with. I'll use a star Auto Shape as an example. If I Shift + Select the bitmap and the star Auto shape, and then choose Modify > Mask > Group as Mask, the bitmap gets clipped to the shape of the star, and the Group as Mask step gets recorded by the History panel. If I then select the now star shaped bitmap, I can add a drop shadow to it. The drop shadow step is also recorded by the History panel. If I Shift + Select the two steps that were recorded in the History panel, [Group + Set LIve Filter] I can click on the Save as Command icon at the bottom of the History panel, give my new Command a name (I'll use Shadow Mask), and then save it to the FW Commands list.
    Once my command is available, I can use it as follows.
    -Choose Modify > Ungroup to ungroup my original bitmap/star mask group
    -Hide bitmap 1
    [note that the star shape is still sitting on top of the stack of  hidden  bitmaps]
    -Resize the star shape as I wish
    -Unhide bitmap number 2
    -Choose Select > Select All to select the star shape and the second bitmap.
    -Apply my custom "Shadow Mask" Command.
    -Export
    -Ungroup and follow the steps above to mask and export the images.
    It's still a bit fussy, but it saves a couple of steps. I'll bet someone could create an extension that makes it even easier.

  • Tile Mask in AS3

    Hello,
    I have created a pixelated effect using an image and
    ActionScript (AS3) located at mask.liquidcomma.com
    I want to be create either a movieclip or bitmap based mask
    that I can tile across the entire image and/or stage also using
    ActionScript.
    Any help would be greatly appreciated.
    Thanks in advance.
    Justin

    You need to have something inside your mask movieclip in order for it to be able to have width and height. Try creating another library movieclip like you did for your circle and use that.  The alternative is to draw the area inside the mask movieclip.  Also, you do not want/need to  use...
    var newMC:MovieClip = new MovieClip()
    newMC=new circ() // circ is my library movieclip
    just use...
    var newMC:circ = new circ(); // circ is my library movieclip

  • Make placed JPEG color transparent in Illustrator CS2/3

    I've been using CorelDRAW! for years and want to learn to use Illustrator CS2 and CS3.
    In CorelDRAW I can import (place) a simple bitmap images, such as a JPEG, and I can select and make transparent any color in the image. An example would be to bring in an image that has a white area, select the white color with the eyedropper tool and then use a slider to change the opacity of the white. It's much simpler to do than to describe it!
    I've searched the Adobe web site, asked some "experts" I know and also spent a few hours searching the web. It seems that there is no such capability built into Illustrator.
    The only way I've been able to accomplish this task is to open the image with Photoshop, select the white area and make it a separate layer, then save it as a native Photoshop file, then import it into Illustrator.
    The only thing annoying about this procedure is now I need an additional copy of a bitmap file.
    Thanks,
    WK

    Kurt Gold,
    Thanks for the definitive answer, it still seems strange to me that this function is not in Illustrator. Oh well, life goes on.
    Yes, CorelDraw's function is indeed called "Bitmap Color Mask."
    /no flame for Bert Philippus/
    Where O' Where is this information in the FM? ;-)
    /no flame, no blame/
    Thanks,
    WK

  • Issues with video playback on iPad 2

    I have an iPad 2 (I had this issue with the iPad 1st gen. as well), and I'm having some playback issues on movies and TV shows purchased through iTunes. I've removed the movies/shows and re-synced, I'm using the cable that came with my iPad.
         The issue is that when I'm watching a movie/show, the video will freeze, get very pixelated, and then pick back up anywhere from 15 seconds to 2 minutes later in the video. I had this issue with 2 of the first gen iPads (as stated above) and took those back to the store, however my iPad 2 was a prize from a contest and cannot be returned.
         I'm sorry if this question has already been answered, but if anyone has any tips or answers about this that could help me out, it would be greatly appreciated.
         Thank you.

    Ok, I created this sample file by tearing some code out of a larger project. Its a little light on comments and the code could be cleaned up a lot but it works fairly well. This example uses stageVideo with a fallback to a regular netstream video object. It is based loosely on several sample stageVideo source that I found online.
    When you tap on the play button in the example it first loads in a custom player container, then it converts the entire stage to a bitmap and masks this bitmap using a mask bitmap that is created from the library. This mask creates a hole through the bitmap version of the stage contents so that the stageVideo is visible. (Because stageVideo is always drawn under everything in the displaylist.)
    This example also has an iOS styled player UI that I created so that it would look similar to the native video player. It has play, pause, a video scrubber and full screen mode. There is a small sample h.264 video included in the example so you can test it out and see it work. On the iPad make sure that your videos are in a folder or in the root and that the folder or files are added to the included file list for your app. Also make sure that the render mode in your app.xml file is either GPU or Direct. Beyond that if you have problems or questions let me know.
    Download the sample file here
    http://www.thebitcrew.com/downloads/StageVideoDemo.zip

  • Looking for transparency clarification

    Hello all,
    I just spent some time trying to figure out what AI CS4 (Mac 10.5.7) does or does not with placed transparent bitmap images. I started with a grayscale TIFF scan and worked my way through several options, using the GraphicConverter as a bitmap image tool, consulting resources on the web from time to time. This is what I found:
    Palette-based transparency (1 colour declared transparent) is ignored, regardless of images colour depth.
    Alpha channel transparency is supported (only) if the image mode is 32 bit RGB (tried PNG, TIFF and TIFF w/ LZW compression, all work fine).
    No transparency at all is supported for CMYK images (even if alpha channel included, regardless of image format & colour depth)
    Is this the same you observe? Could I have found this information anywhere in the AI documentation? Should someone be shot for introducing such a vast array of colour and transparency options? (Ignore the last q. Probably it was the Swiss that invented it, like everything else )
    Cheers,
    Lutz

    Pattern is a native AI pattern with bitmaps placed above it. PSD, TIFF, and PDF images are CMYK. PNG and GIF created via Save for Web in Photoshop. TIFF images are layered TIFFs. File created by opening new PS document with transparent background and a simple brush stroke was created, then the file was saved. No special alpha channel consideration was taken into account. This also doesn't take into account the use of clipping paths -- which would further extend the range of transparency in bitmaps, albeit masked transparency rather than alpha transparency. In addition, the 16bit images are flattened to 8bit upon placing into Illustrator, but as you can see, the transparency holds up.
    All this is somewhat moot due to the fact that PSD files work flawlessly for 99.9% of files and there's never any reason to use another format anymore, especially if you are working within only the Creative Suite applications. If you are bound to Graphics Converter,some limitations you are seeing may be due to that application, not Illustrator. The only thing I use GC for is multi-page TIFF images (which Photoshop REALLY needs to add support for.)

  • StageVideo usage from Flex Application?

    Hello everyone!
    I'm trying out new StageVideo class and if I add it pure AS3 project everything works perfect.
    But if I try to use the same code in Flex project I get no video output, but looks like the video itself is playing ('cos I can hear the sound track).
    I've tried to remove everything from mxml file to make sure nothing covers video, tried to remove all background changes and etc. (put here any other stuff that might overlay stage), but nothing helped.
    Is it possible to use StageVideo from Flex app at all? May be there's some trick to it?
    Can someone help? Thanks in advance!

    Hello,
    I guess there is no way to attach files to this post. I made the main app an Application instead of a ViewNavigatorApplication for simplicity sake. It's a basic mobile application project for an ipad, so in Flash Builder just create a basic project using that profile and drop these in. I appreciate you taking a look at it.
    thx
    Main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                                                          xmlns:s="library://ns.adobe.com/flex/spark"
                                                                          creationComplete="init()">
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
                        <![CDATA[
                                  private var mediaPlayer:CatVideoPlayer;
                                  private function init():void
                                            var videoFile:File = File.applicationDirectory.resolvePath("preview.mp4");
                                            var videoPath:String = new File(new File(videoFile.url).nativePath).url;
                                            mediaPlayer = new CatVideoPlayer();
                                            mediaPlayer.width = 640;
                                            mediaPlayer.height = 360;
                                            addElement(mediaPlayer);
                                            mediaPlayer.source = videoPath;
                        ]]>
    </fx:Script>
    </s:Application>
    Custom UI Component:
    package
              import flash.display.Bitmap;
              import flash.display.BitmapData;
              import flash.display.Sprite;
              import flash.display.StageAlign;
              import flash.display.StageScaleMode;
              import flash.events.Event;
              import flash.events.StageVideoAvailabilityEvent;
              import flash.events.StageVideoEvent;
              import flash.geom.Rectangle;
              import flash.media.StageVideo;
              import flash.media.StageVideoAvailability;
              import flash.media.Video;
              import flash.net.NetConnection;
              import flash.net.NetStream;
              import mx.core.FlexGlobals;
              import mx.core.UIComponent;
              public class CatVideoPlayer extends UIComponent
                        private var _defaultHeight:Number = 360;
                        private var _defaultWidth:Number = 640;
                        private var _ns:NetStream;
                        private var _obj:Object;
                        private var _source:String;
                        private var _sourceChanged:Boolean;
                        private var _stageBitmap:Bitmap;
                        private var _stageVideoAv:Boolean = false;
                        private var _sv:StageVideo;
                        private var _vd:Video;
                        private var _vidMask:Sprite;
      //private var _videoStage:Sprite;
                        public function CatVideoPlayer()
                                  super();
                                  mouseEnabled = false;
                                  addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
                        public function onCuePoint(info:Object):void
      trace("CatVideoPlayer.onCuePoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
                        public function onMetaData(info:Object):void
      //trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
      //this.width = info.width;
      //this.height = info.height;
                        public function onPlayStatus(info:Object):void
      trace("CatVideoPlayer.onPlayStatus: " + info.data);
                        public function onXMPData(info:Object):void
      trace("CatVideoPlayer.onXMPData: " + info.data);
                        public function set source(value:String):void
                                  _source = value;
                                  _sourceChanged = true;
                                  invalidateProperties();
                        override protected function commitProperties():void
                                  super.commitProperties();
                                  if (_sourceChanged)
                                            setState("showVideoPlayer");
                                            _sourceChanged = false;
                        override protected function createChildren():void
                                  super.createChildren();
      trace("createChildren fired in CatVideoPlayer");
      //_videoStage = new Sprite();
      //addChild(_videoStage);
                        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                                  super.updateDisplayList(unscaledWidth, unscaledHeight);
                         * Convert the current screen to a bitmap and mask it to show stageVideo.
                        private function convertStageToBitmap():void
                                  var bitmapData:BitmapData = new BitmapData(FlexGlobals.topLevelApplication.width, FlexGlobals.topLevelApplication.height);
                                  _stageBitmap = new Bitmap();
                                  _vidMask = new Sprite();
                                  _vidMask.graphics.beginFill(0x000000);
                                  _vidMask.graphics.moveTo(0, 0);
                                  _vidMask.graphics.drawRect(0, 0, _defaultWidth, _defaultHeight);
                                  _vidMask.graphics.endFill();
      //bitmapData.draw(this);
                                  bitmapData.draw(FlexGlobals.topLevelApplication.document);
                                  _stageBitmap.bitmapData = bitmapData;
                                  _stageBitmap.cacheAsBitmap = true;
                                  _vidMask.cacheAsBitmap = true;
      //addChild(_vidMask);
                                  _stageBitmap.mask = _vidMask;
      //addChild(_stageBitmap);
      //backgroundImg_mc.visible = false;
      //playerWindow_mc.visible = false;
      //initVideo();
                         * Handles the mouse clicks that occur on UI components.
                         * @param e
                        private function handleInterfaceClick(e:Event):void
                                  e.preventDefault();
                                  switch (e.target.name)
      case "playBtn_mc":
                                                      setState("showVideoPlayer");
                                                      break;
      case "closeVideo_mc":
                                                      setState("closePlayer");
                                                      break;
      default:
      //do default
                         * Plays the video using StageVideo if supported.
                        private function initVideo():void
                                  var nc:NetConnection = new NetConnection();
                                  nc.connect(null);
                                  _ns = new NetStream(nc);
                                  _obj = new Object();
                                  _ns.client = _obj;
                                  _ns.bufferTime = 2;
                                  _ns.client = _obj;
      //_obj.onMetaData = MetaData;
      //_obj.onCuePoint = CuePoint;
                                  if (_stageVideoAv)
      //use stageVideo
      trace("using stage video in CatVideoPlayer.initVideo()");
                                            _sv = stage.stageVideos[0];
                                            _sv.addEventListener(StageVideoEvent.RENDER_STATE, onRender);
                                            _sv.attachNetStream(_ns);
      else
      //fallback to video class
      trace("using normal video in CatVideoPlayer.initVideo()");
                                            _vd = new Video(_defaultWidth, _defaultHeight);
      //_vd.x = 152;
      //_vd.y = 143;
                                            addChild(_vd);
                                            _vd.attachNetStream(_ns);
      //addChild(videoUI_mc);
                                  _ns.play(_source);
                        private function onAddedToStage(event:Event):void
      trace("onAddedToStage fired in CatVideoPlayer");
                                  stage.scaleMode = StageScaleMode.NO_SCALE;
                                  stage.align = StageAlign.TOP_LEFT;
                                  stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, onStageVideoAvailability);
                        private function onRender(e:StageVideoEvent):void
    //                              if (!videoUI_mc.fsMode)
    //                                        _sv.viewPort = new Rectangle(152, 143, 720, 480);
    //                              else
                                            _sv.viewPort = new Rectangle(0, 0, 640, 360);
                        private function onStageVideoAvailability(e:StageVideoAvailabilityEvent):void
                                  _stageVideoAv = (e.availability == StageVideoAvailability.AVAILABLE);
                                  initVideo();
                         * Animate the video player's UI states.
                         * @param currentState The different states the player is in.
                        private function setState(currentState:String):void
      trace("setState fired in CatVideoPlayer");
                                  switch (currentState)
      case "showVideoPlayer":
      //playBtn_mc.visible = false;
      //addChild(playerWindow_mc);
      //addChild(closeVideo_mc);
      //playerWindow_mc.visible = true;
      //closeVideo_mc.visible = true;
      //TweenLite.from(playerWindow_mc, 1, { alpha:0, onComplete:function(){ convertStageToBitmap(); } });
      //TweenLite.from(closeVideo_mc, 1, { alpha:0 });
                                                      convertStageToBitmap();
                                                      break;
      case "closePlayer":
      //removeVideoPlayer();
      //playerWindow_mc.visible = false;
      //playBtn_mc.visible = true;
                                                      break;
      default:
      //do default

  • Video playback on iPad 2?

    is it possible to stream video on iPad 2 using either the FLVPlayback component or the Video Class?
    i've tried all H.264, Sorenson, ON2 VP6 formats, mp4,m4v,f4v,flv
    the videos play OK in the IDE, but on iPad 2 no video shows up
    i'm using the Flash 5.5 IDE and AIR 3.2

    Ok, I created this sample file by tearing some code out of a larger project. Its a little light on comments and the code could be cleaned up a lot but it works fairly well. This example uses stageVideo with a fallback to a regular netstream video object. It is based loosely on several sample stageVideo source that I found online.
    When you tap on the play button in the example it first loads in a custom player container, then it converts the entire stage to a bitmap and masks this bitmap using a mask bitmap that is created from the library. This mask creates a hole through the bitmap version of the stage contents so that the stageVideo is visible. (Because stageVideo is always drawn under everything in the displaylist.)
    This example also has an iOS styled player UI that I created so that it would look similar to the native video player. It has play, pause, a video scrubber and full screen mode. There is a small sample h.264 video included in the example so you can test it out and see it work. On the iPad make sure that your videos are in a folder or in the root and that the folder or files are added to the included file list for your app. Also make sure that the render mode in your app.xml file is either GPU or Direct. Beyond that if you have problems or questions let me know.
    Download the sample file here
    http://www.thebitcrew.com/downloads/StageVideoDemo.zip

  • AS3 drag and drop masked bitmaps - not working

    I have a drag and drop project using bitmaps that were masked using fireworks. All bitmaps are PNG (fireworks files) and one object is GIF. All objects were converted into movie clips.
    PROBLEM
    All movie clips from PNG's can be dragged, but they can't be dropped. However, the GIF movie clip responds to both drag and drop.
    ActionScript worked when all movie clips had GIF's.
    Is this problem because the objects were masked or for any other reason?
    Note: Objects were masked because their border is very fussy and cropping them doesn't help with the quality of their image.
    // ACTION SCRIPT
    var startX:Number;
    var startY:Number;
    var counter:Number = 0;
    name_mc1.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc1.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc2.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc2.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc3.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc3.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc4.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc4.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc5.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc5.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc6.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc6.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc7.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc7.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    function placeUP(event:MouseEvent):void {
    event.target.startDrag(true);
    mess_txt.text = "";
    event.target.parent.addChild(event.target);
    startX = event.target.x;
    startY = event.target.y;
    function placeDown(event:MouseEvent):void {
    event.target.stopDrag();
    var myTargetName:String = "target" + event.target.name;
    var myTarget:DisplayObject = getChildByName(myTargetName);
    if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
      mess_txt.text = "Good Job!";
      event.target.removeEventListener(MouseEvent.MOUSE_DOWN, placeUP);
      event.target.removeEventListener(MouseEvent.MOUSE_UP, placeDown);
      event.target.buttonMode = false;
      event.target.x = myTarget.x;
      event.target.y = myTarget.y;
      counter++;
    } else {
      mess_txt.text = "Try Again!";
      event.target.x = startX;
      event.target.y = startY;
    if(counter == 7){
            mess_txt.text = "Congratulations, you're finished!";
    name_mc1.buttonMode = true;
    name_mc2.buttonMode = true;
    name_mc3.buttonMode = true;
    name_mc4.buttonMode = true;
    name_mc5.buttonMode = true;
    name_mc6.buttonMode = true;
    name_mc7.buttonMode = true;
    Thanks for any help!
    German

    Kglad:
    Thanks. Your code worked as well.
    German

  • WS_EX_LAYERED from bitmap uses black as transparency mask

    I'm trying to display a transparent 32bit bitmap on a WS_EX_LAYERED hwnd and set the per-pixel transparency with it, but somehow it looks that the transparency is decided by black pixels instead of the bitmap's alpha value.
    Here's the result with a black bitmap with few colored circles over it :
    Code :
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    LPCWSTR szWindowClass = L"TransparentClass";
    WNDCLASSEX wcex = { 0 };
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.lpfnWndProc = DefWindowProc;
    wcex.hInstance = hInstance;
    wcex.lpszClassName = szWindowClass;
    RegisterClassEx(&wcex);
    HWND hWnd = CreateWindowEx(WS_EX_LAYERED, szWindowClass, 0, WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
    HBITMAP hbmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), L"C:\\Users\\Domenico\\Desktop\\mask.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    //LPBYTE bits = (LPBYTE)hbmp;
    //int sizet = 500 * 500;
    //for (int pixel = 0; pixel != sizet; ++pixel)
    // bits[0] = bits[0] * bits[3] / 255;
    // bits[1] = bits[1] * bits[3] / 255;
    // bits[2] = bits[2] * bits[3] / 255;
    // bits += 4;
    HDC hdcScreen = GetDC(0);
    HDC hdc = CreateCompatibleDC(hdcScreen);
    ReleaseDC(0, hdcScreen);
    HBITMAP hbmpold = (HBITMAP)SelectObject(hdc, hbmp);
    POINT dcOffset = { 0, 0 };
    SIZE size = { 500, 500 };
    BLENDFUNCTION bf;
    bf.BlendOp = AC_SRC_OVER;
    bf.BlendFlags = 0;
    bf.SourceConstantAlpha = 255;
    bf.AlphaFormat = AC_SRC_ALPHA;
    UpdateLayeredWindow(hWnd, 0, 0, &size, hdc, &dcOffset, 0, &bf, ULW_ALPHA);
    SelectObject(hdc, hbmpold);
    DeleteDC(hdc);
    DeleteObject(hbmp);
    ShowWindow(hWnd, SW_SHOW);
    MSG msg;
    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0))
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    return (int)msg.wParam;
    Is it this the default behaviour to check for transparency ? I need black pixels to recreate a custom shadow-like effect.
    I tried to multiply every bitmap's pixel as suggested in MDSN doc but I'm getting access violation while trying to do so.
    Last question : Is it possible to repaint the whole window with a new bitmap at runtime ? Since you have call the updatelayeredwindow function before showing the window I'm thinking it should be impossible, right ?

    I'm trying to display a transparent 32bit bitmap on a WS_EX_LAYERED hwnd and set the per-pixel transparency with it, but somehow it looks that the transparency is decided by black pixels instead of the bitmap's alpha value.
    Here's the result with a black bitmap with few colored circles over it :
    Code :
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    LPCWSTR szWindowClass = L"TransparentClass";
    WNDCLASSEX wcex = { 0 };
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.lpfnWndProc = DefWindowProc;
    wcex.hInstance = hInstance;
    wcex.lpszClassName = szWindowClass;
    RegisterClassEx(&wcex);
    HWND hWnd = CreateWindowEx(WS_EX_LAYERED, szWindowClass, 0, WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
    HBITMAP hbmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), L"C:\\Users\\Domenico\\Desktop\\mask.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    //LPBYTE bits = (LPBYTE)hbmp;
    //int sizet = 500 * 500;
    //for (int pixel = 0; pixel != sizet; ++pixel)
    // bits[0] = bits[0] * bits[3] / 255;
    // bits[1] = bits[1] * bits[3] / 255;
    // bits[2] = bits[2] * bits[3] / 255;
    // bits += 4;
    HDC hdcScreen = GetDC(0);
    HDC hdc = CreateCompatibleDC(hdcScreen);
    ReleaseDC(0, hdcScreen);
    HBITMAP hbmpold = (HBITMAP)SelectObject(hdc, hbmp);
    POINT dcOffset = { 0, 0 };
    SIZE size = { 500, 500 };
    BLENDFUNCTION bf;
    bf.BlendOp = AC_SRC_OVER;
    bf.BlendFlags = 0;
    bf.SourceConstantAlpha = 255;
    bf.AlphaFormat = AC_SRC_ALPHA;
    UpdateLayeredWindow(hWnd, 0, 0, &size, hdc, &dcOffset, 0, &bf, ULW_ALPHA);
    SelectObject(hdc, hbmpold);
    DeleteDC(hdc);
    DeleteObject(hbmp);
    ShowWindow(hWnd, SW_SHOW);
    MSG msg;
    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0))
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    return (int)msg.wParam;
    Is it this the default behaviour to check for transparency ? I need black pixels to recreate a custom shadow-like effect.
    I tried to multiply every bitmap's pixel as suggested in MDSN doc but I'm getting access violation while trying to do so.
    Last question : Is it possible to repaint the whole window with a new bitmap at runtime ? Since you have call the updatelayeredwindow function before showing the window I'm thinking it should be impossible, right ?
    1. Transparency in BGRA (32 bpp) bitmaps is controlled by the Alpha byte. When A is 0 the pixel is completely transparent, when A is 255 the pixel is completely opaque.
    2. HBITMAP doesn't point to the pixels. Given an HBITMAP, there are APIs to get and set the pixels: GetDIBits, SetDIBits.
    3. To repaint the window, call UpdateLayeredWindow again.

  • Clipping mask, object too complex, can't use bitmap either

    Hi all,
    I'm in Illustrator CS4 trying to make a page that has content that I want to embed within a rounded rectangle.  Sounds easy enough.
    I've been successful sticking some content into a rounded rectangle, until now.  Now I have a page that apparently is "too complex".  It has lots of transparencies and gradients and such.  Once I try to do the clipping mask thing I am told it's very complex and may not print or work right.  I go ahead anyway and it just looks blank/invisible.
    Then I thought artboards might be a way to do this, but I couldn't see how you could make an artboard that is a shape other than a rectangle (I'd like a rounded rectangle).
    So then I thought if export the image to a bitmap and then repaste it in, maybe I could embed the bitmap into the rounded rectangle.  Pain in the butt, but I'm looking for any solution.  But that doesn't even work because it says the top selected object must be "a path, a compound shape, a text object, or a group of those".  So a bitmap can't be used
    Has anyone had more luck with this?  In CorelDraw I've always just placed objects, no matter how complex, into a "container" without any issues.  Certainly there's a way to do the same here.  This drawing isn't *that* complex.
    Thanks in advance for your advice!

    Check your flattener settings in the prefs, specific flattening options of your object groups and also the raster effects resolution for your document. Reduccing their dpi should make working possible.
    Mylenium

  • Clipping mask on placed bitmaps

    I'm new to Illustrator for Mac.
    Question:
    Why is placed bitmaps automatically placed with a clipping mask? In CS3 for windows no such thing is applied. It's annoying because it's an extra step to delete the clipping mask before doing a trace.

    Are you "Placing" or "Pasting" the bitmap file? I get a mask when pasting but not placing (I agree, it is annoying).

  • How can give reverse effect of mask in image's bitmap ?

    Hello ,
    I want to mask reverse in image bitmap.
    I find below post for mask reverse in spark group using graphics rectangle.
    http://forums.adobe.com/message/2885005
    Is there any way to mask some porsion in image ?
    i also want that when we are masking in image then only masking object's part is visible can we do reverse effect i mean other portion of the image is visble and only mask object portin is invisible.
    Thanks in advanced if anybody have idea about this.
    Hello friends, anyone have idea about this ?

    That question is far too broad. It's like asking 'How big is big?' It depends on what you're talking about. Or in this case, what you consider a 'nice effect'.
    Surf the internet. Find some photos that have a look you like -- something similar to what you would want to do with your photos. Then you can at post one or two of those samples here and give us some idea of what you want to do.
    --OB

Maybe you are looking for