Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

Adding Objects to an Image then Saving and Loading it upon closing and re-opening

$
0
0

Hey everyone, as some of you may or may not know, I am currently in the process of making an Android and iOS game, using Flash and AS3. Within the menu you can customize what your character looks like by adjusting it with a color slider and adding gear to the character by selecting the gear you want. When clicking on a certain piece of gear to add to your character, it places 3 pieces of of gear onto your character: Head, Right Leg, and Left Leg, respectively. I do so by using the code below:

 

 

var Head:Loader = new Loader();

var RightLeg:Loader = new Loader();

var LeftLeg:Loader = new Loader();

 

Add.addEventListener(MouseEvent.CLICK, loadPic1);   

Remove.addEventListener(MouseEvent.CLICK, removePic1);   

 

 

function loadPic1(MouseEvent):void {

    var headRequest:URLRequest=new URLRequest("TestHead.png");

    Head.load(headRequest);

          Head.y = -150;

    Sliders.Dino.Head.addChild(Head); 

          var rightRequest:URLRequest=new URLRequest("TestRightLeg.png");

    RightLeg.load(rightRequest);

    Sliders.Dino.RightLeg.addChild(RightLeg);

          var leftRequest:URLRequest=new URLRequest("TestLeftLeg.png");

    LeftLeg.load(leftRequest);

    Sliders.Dino.LeftLeg.addChild(LeftLeg);

}

 

function removePic1(MouseEvent):void {

    Head.unload();

RightLeg.unload();

LeftLeg.unload();

}

 

This all works fine for test purposes. Is there anyway to add the gear directly to the image, save it at it's current state, then when reopened (or loaded into the game) it loads the previously saved image with gear on it?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 238792

Trending Articles