Solved

Masking In Flex

Posted on 2011-03-06
2
844 Views
Last Modified: 2013-11-12
I am trying to get an image to move behind a mask in flex.  here is the code:

public function ImageOnStage(bmp:Bitmap)
            {
                  super();

                    var myShape:Sprite = new Sprite();
                  myShape.graphics.lineStyle(1, 0x000000);
                  myShape.graphics.beginFill(0x0000ff);
                  
                  myShape.graphics.lineTo(154.6862, 173.2246);
                  myShape.graphics.lineTo(183.2958, 171.4443);
                  myShape.graphics.lineTo(221.7057, 165.7216);
                  myShape.graphics.lineTo(254.3983, 156.2645);
                  myShape.graphics.lineTo(292.5086, 139.3242);
                  
                  myShape.graphics.lineTo(315.4861, 127.1510);
                  myShape.graphics.lineTo(330.4385, 117.6560);
                  myShape.graphics.lineTo(344.3118, 107.2436);
                  myShape.graphics.lineTo(352.0309, 100.6078);
                  myShape.graphics.lineTo(361.9321, 91.2264);
                  
                  myShape.graphics.lineTo(368.1939, 82.8642);
                  myShape.graphics.lineTo(372.3505, 74.1243);
                  myShape.graphics.lineTo(373.2142, 65.1147);
                  myShape.graphics.lineTo(372.7254, 57.5077);
                  myShape.graphics.lineTo(371.4799, 53.4322);
                  
                  myShape.graphics.lineTo(368.1330, 47.0660);
                  myShape.graphics.lineTo(362.9509, 40.9697);
                  myShape.graphics.lineTo(355.6635, 36.1682);
                  myShape.graphics.lineTo(344.5973, 29.8022);
                  myShape.graphics.lineTo(335.2389, 25.6178);
                  
                  myShape.graphics.lineTo(314.0247, 18.1188);
                  myShape.graphics.lineTo(291.2447, 12.0224);
                  myShape.graphics.lineTo(272.9992, 8.6236);
                  myShape.graphics.lineTo(264.2212, 7.1979);
                  myShape.graphics.lineTo(223.5897, 50.0132);
                  
                  myShape.graphics.lineTo(196.6493, 79.1452);
                  myShape.graphics.lineTo(171.0339, 105.6289);
                  myShape.graphics.lineTo(144.9767, 130.7583);
                  myShape.graphics.lineTo(131.2858, 144.4715);
                  myShape.graphics.lineTo(113.1782, 159.9203);
                  
                  myShape.graphics.lineTo(104.7869, 166.9825);
                  myShape.graphics.lineTo(103.5696, 167.9901);
                  myShape.graphics.lineTo(102.5271, 169.3665);
                  myShape.graphics.lineTo(102.4287, 170.2119);
                  myShape.graphics.lineTo(102.5271, 171.6275);
                  
                  myShape.graphics.lineTo(102.9993, 172.1780);
                  myShape.graphics.lineTo(103.7862, 172.6499);
                  myShape.graphics.lineTo(105.8910, 173.0431);
                  myShape.graphics.lineTo(108.7240, 173.3774);
                  myShape.graphics.lineTo(154.6862, 173.2246);
                  
                  this.addChild(myShape);
                  
                  var bUtil:BitmapUtil =new BitmapUtil();
                  originalBitmap = bUtil.cloneBitmap(bmp);                  
                  this.bitmapImage = bmp;
                  bitmapImage.smoothing = true;
                  this.type = TYPE;
                  ImageOnStage.idCount++;
                  this.idImage = ImageOnStage.idCount+".png";
                  
                  image.mask = myShape;
                  image.startDrag();
}

The issue is the image.startDrag.  It does not work.  How do I make the image scroll behind the mask.  I want the mask to remain fixed.  Anyone?
0
Comment
Question by:mhoard8110
  • 2
2 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
Comment Utility
What exactly does not work?

Just a thought. If you have a mask that masks something behind it, you will not be able to click and drag the image behind it if you click on the masked area.
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now