Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function addFullsizeInstance(type:String, src:String) {
- var fullsizeLoader:Loader = new Loader();
- fullsizeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadFullsizeComplete);
- fullsizeLoader.load(new URLRequest(src));
- function onLoadFullsizeComplete(e:Event):void {
- var fullsize:LoadedSprite = new LoadedSprite();
- //Loop to Remove Other Instances From Stage
- for (var q in ComponentsOnStage[type]) {
- trace (q);
- removeChild(q);
- }
- ComponentsOnStage[type] = [];
- addChild(fullsize);
- ComponentsOnStage[type] = [fullsize];
- fullsize.addChild(fullsizeLoader);
- fullsize.x = 300;
- fullsize.y = 300;
- fullsize.addEventListener(MouseEvent.MOUSE_UP, dragFnstop);
- fullsize.addEventListener(MouseEvent.MOUSE_DOWN, dragFn);
- fullsize.bodyType = type;
- fullsize.src = src;
- //body
- if(type == 'body') {
- fullsize.x = 130;
- fullsize.y = 167;
- }
- //eyes
- if(type == 'eyes') {
- fullsize.x = 130;
- fullsize.y = 167;
- }
- //hair
- if(type == 'hair') {
- fullsize.x = 130;
- fullsize.y = 167;
- }
- //nose
- if(type == 'nose') {
- fullsize.x = 130;
- fullsize.y = 167;
- }
- //mouth
- if(type == 'mouth') {
- fullsize.x = 130;
- fullsize.y = 167;
- }
- function dragFn(event:MouseEvent){
- fullsize.startDrag();
- };
- function dragFnstop(event:MouseEvent){
- fullsize.stopDrag();
- var target = fullsize.dropTarget.parent;
- if(target == remove_btn) {
- removeChild(fullsize);
- }
- };
- }
- }
Add Comment
Please, Sign In to add comment