Jump to content

Recommended Posts

Hi

 

I have a startDrag function set up on a loader and mask that when the mouse is down on the loader it drags, when not it doesn't. There is also 2 buttons that control whether mask1 or mask2 is used.

 

What i would like however is when the mouse is down - the area of the loader outside of the mask is visible but only by about 10/20% alpha, that way the user can see where all the image is while dragging. Is this possible? I have the swf set up on the following link:

 

http://www.tiltworld.co.uk/TH785RFD/myDrag.swf

 

Full code can be seen below and i have attached the zip with the .fla file:

 

// Imports.
import flash.display.Sprite;
//

// Sets masks as false on start up.
maskP1.visible = false;
maskP2.visible = false;
//

// Load External Image into loader.
var imageP1:Loader = new Loader();
var request:URLRequest = new URLRequest("http://www.tiltworld.co.uk/TH785RFD/image.jpg");
imageP1.load(request);
addChild(imageP1);
imageP1.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);

function onLoadComplete(event:Event):void {
imageP1.x = 67;
imageP1.y = 67;
imageP1.width = 425;
imageP1.height = 282;
}
//

// Make Loader a Child of Sprite.
var imageP1_Content:Sprite = new Sprite();
imageP1_Content.buttonMode = true;
imageP1_Content.addChild(imageP1);
addChild(imageP1_Content);
//

// Set Drag Function.
imageP1.addEventListener(MouseEvent.MOUSE_DOWN, drag);
imageP1.addEventListener(MouseEvent.MOUSE_UP, drop);

function drag(event:Event):void {
  		imageP1_Content.startDrag();
}
function drop(event:Event):void {
  		imageP1_Content.stopDrag();
}
//

// Set functions for mask scale.
_10x10.addEventListener(MouseEvent.MOUSE_UP,scale1);
_20x20.addEventListener(MouseEvent.MOUSE_UP,scale2);

function scale1 (event:Event):void {
maskP1.visible = true;
maskP2.visible = false;
imageP1.mask = maskP1;
}

function scale2 (event:Event):void {
maskP2.visible = true;
maskP1.visible = false;
imageP1.mask = maskP2;
}
//

 

Please, please help! :)

 

Thanks in advance

 

John

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/213050-as3-alpha-mask-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.