literature

AS3 Doll Dress up Codes

Deviation Actions

Viral-Zombie's avatar
By
Published:
319 Views

Literature Text

AS3 simple dress up game codes!!! </>


Drag drop:
shirt_mc.addEventListener(MouseEvent.MOUSE_DOWN, drag);
shirt_mc.addEventListener(MouseEvent.MOUSE_DOWN, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, drop);

function drag(e:MouseEvent):void
{
    e.target.startDrag();
}

function drop(e:MouseEvent):void
{
    stopDrag();
}

Roll over button:
//First, add all of your event listeners
myButton.addEventListener(MouseEvent.CLICK, myButtonClick);
myButton.addEventListener(MouseEvent.ROLL_OVER, myButtonRollover);
myButton.addEventListener(MouseEvent.ROLL_OUT, myButtonRollout);

function myButtonClick(ev:MouseEvent):void
{
//Put code you'd like to execute when the button is clicked below
trace("myButton has been clicked.");
}
function myButtonRollover(ev:MouseEvent):void
{
//Put code you'd like to execute when the button is rolled over below
trace("myButton has been rolled over.");
}
function myButtonRollout(ev:MouseEvent):void
{
//Put code you'd like to execute when the button is rolled out below
trace("myButton has been rolled out.");
}

custom Cursor:

/* Custom Mouse Cursor
Replaces the default mouse cursor with the specified symbol instance.
*/

stage.addChild(cursor_mc);
cursor_mc.mouseEnabled = false;
cursor_mc.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

function fl_CustomMouseCursor(event:Event)
{
cursor_mc.x = stage.mouseX;
cursor_mc.y = stage.mouseY;
}
Mouse.hide();

//To restore the default mouse pointer, uncomment the following lines:
//shirt_mc.removeEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);
//stage.removeChild(shirt_mc);
//Mouse.show();

Colour Picker
import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent;
import flash.geom.ColorTransform;

var BodycolorInfo:ColorTransform = Body.transform.colorTransform;
cpBody.addEventListener(ColorPickerEvent.CHANGE, colorChange);

BodycolorInfo.color = cpBody.selectedColor;
Body.transform.colorTransform = BodycolorInfo;

function colorChange(e:Event):void
{
BodycolorInfo.color = cpBody.selectedColor;
Body.transform.colorTransform = BodycolorInfo;
}

Button to web link
buts_mc.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage(event:MouseEvent):void
{
navigateToURL(new URLRequest("www.creaturefeaturemusic.com"), "_blank");
}

Click to location
pants_mc.addEventListener(MouseEvent.CLICK, fl_ClickToPosition_2);

function fl_ClickToPosition_2(event:MouseEvent):void
{
pants_mc.x = 202.35;
pants_mc.y = 185.95;
}

click to Hide
smile_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
smile_mc.visible = false;
}

Click to hide and show
grey_mc.visible = false;
grey_btn.addEventListener(MouseEvent.CLICK, showgrey, false, 0, true);

function showgrey(e:Event):void
{
   if( grey_mc.visible == true){
       grey_mc.visible = false;
   }else{
       grey_mc.visible = true;
   }
}

stop();
From my "game" at viral-zombie.deviantart.com/ar…
These codes are nessesity for anyone wanting to make a as3 doll game.
Use what ever you like

Substitute any _mc or _btn instance name with your own symbol's instance name.

And if you have questions ask in comments.
If you like give a llama!Llama Hug 

***** Creaturefeaturemusic.com is not mine, but it is one wicked website for one fiendish band!!!!
© 2014 - 2024 Viral-Zombie
Comments0
Join the community to add your comment. Already a deviant? Log In