-
Last edited by oddball25; 09-10-2010 at 11:15 AM.
-
Code:
// Imports.
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
//
// 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("images/fire-color.png");
imageP1.load(request);
addChild(imageP1);
imageP1.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
var imageA1:Bitmap;
function onLoadComplete(event:Event):void {
imageA1=new Bitmap(Bitmap(imageP1.content).bitmapData.clone());
imageA1.alpha=0;
imageP1.x=imageA1.x=67;
imageP1.y=imageA1.y=67;
imageP1.width=imageA1.width=425;
imageP1.height=imageA1.height=282;
imageA1_Content.addChild(imageA1);
}
//
// Make Loader a Child of Sprite.
var image_Content:Sprite = new Sprite();
var imageP1_Content:Sprite = new Sprite();
var imageA1_Content:Sprite = new Sprite();
image_Content.buttonMode=true;
imageP1_Content.addChild(imageP1);
image_Content.addChild(imageA1_Content);
image_Content.addChild(imageP1_Content);
addChild(image_Content);
//
// Set Drag Function.
imageP1.addEventListener(MouseEvent.MOUSE_DOWN, drag);
imageP1.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(event:Event):void {
image_Content.startDrag();
imageA1.alpha=.2;
}
function drop(event:Event):void {
image_Content.stopDrag();
imageA1.alpha=0;
}
//
// 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;
}
//
-
Wow, dawsonk thank you so much for the code to get this working
A big thank you to helping me out with this one, appreciate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|