0

I was hoping you could help me ( I'm pretty new to AS3 ) I bumbling through and making gradual progress. I'm wanting to have it so that when I drag my movie clip x and y across the stage and rotate it, the rotation is saved to the sharedOject. It may also be worth noting that you can only rotate the draggable object in a certain mode - activated by a mouse click.

stop();
 // save functions

 var mySO:SharedObject = SharedObject.getLocal("iDesign");

 bones_mc.x = mySO.data.my_x;
 bones_mc.y = mySO.data.my_y;
 // ------ saves last rotation --- bones_mc.rotation = mySO.data.my_rot;

 if (!mySO.data.my_y) {
 bones_mc.x = 424;
 bones_mc.y = 119;
 }

save_btn.addEventListener (MouseEvent.CLICK, clickersave);

function clickersave (e:MouseEvent):void {
mySO.data.my_x = bones_mc.x;
mySO.data.my_y = bones_mc.y;
// ---- stops the spin mySO.data.my_rot = bones_mc.rotation;    
mySO.flush ();
}

bones_mc.buttonMode=true;

// UI btns TOOLS --------------------- 

Thanks!

user3082874
  • 61
  • 2
  • 11
  • 1
    Can you specify the part you're having trouble with? – Marcela Jan 10 '14 at 21:17
  • Hello, all of the above is working well. Although I'm not sure as to how to go about making it so when I rotate the draggable object, the shared object saves the last rotation - and remembers the x and y of the saved movie clip. if that makes sense? thanks, // ---- stops the spin mySO.data.my_rot = bones_mc.rotation; – user3082874 Jan 13 '14 at 10:43
  • 1
    It looks like you just need to uncomment the portion of code where you're storing `my_rot` in your Shared Ojbect. – Marcela Jan 13 '14 at 19:20
  • Hello :-) I've commented those out, as ran into bit of a mental wall. This commented line doesn't retain my last rotation of the shared object - that's as far as I got and commented it out. So imagine I have rotated my dragable object 45 degrees and moved it across the stage, clicked save, re-opened it... the object is where I last left it (across the stage) without the rotation, i want it to remember the last rotation as well as the position. If that makes sense? – user3082874 Jan 14 '14 at 12:51

1 Answers1

0

I tested out your code by uncommenting the pertinent parts and it works just fine. I'm not sure where your exact problem is, but try this:

stop();
// save functions

var mySO:SharedObject = SharedObject.getLocal("iDesign");

bones_mc.x = mySO.data.my_x;
bones_mc.y = mySO.data.my_y;
bones_mc.rotation = mySO.data.my_rot;

if (!mySO.data.my_y) 
{
    bones_mc.x = 424;
    bones_mc.y = 119;
}

save_btn.addEventListener (MouseEvent.CLICK, clickersave);

function clickersave (e:MouseEvent):void 
{
    mySO.data.my_x = bones_mc.x;
    mySO.data.my_y = bones_mc.y;
    mySO.data.my_rot = bones_mc.rotation;    
    mySO.flush ();
}

bones_mc.buttonMode=true;
Marcela
  • 3,728
  • 1
  • 15
  • 21