Solved

Having trouble with flash builder and masking

Posted on 2011-03-06
3
521 Views
Last Modified: 2012-05-11
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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35052592
set this and try:
myShape.mouseEnabled = false;
myShape.mouseChildren = false;

Open in new window


Warm Regards
Deepanjan Das
0
 

Author Comment

by:mhoard8110
ID: 35052675
thanks for the post.  the bigger issue I have is the:
                  image.startDrag();
returns an error in flash builder.  

myShape.startDrag();   and
this.startDrag();

work, but image.startDrag does not.
0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 35052812
I did not find the image variable declared in your code snippet, may be I am missing something here.
I guess image is a Bitmap, so, try adding the image to another sprite and drag the sprite.

Warm Regards
Deepanjan Das
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

623 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