When you have the e.target you can set this to a variable scoped to the
class and set a boolean flag to allow keyboard movement of the target.
package {
public class moo{
public var itemToMove:*;
public var bMove:Boolean = false
public function setupEventHandlers():void{
// keyboard down and up etc
}
public function clickHandler(e:MouseEvent3d):void
{
itemToMove = e.target;
bMove = true;
}
public function keydownhandler(e:keyboardevent):void
{
if (e.keycode == 1240214){ itemToMove.x += 1;}
}
}
}
On 22 July 2010 10:30, Darcey Lloyd <[email protected]> wrote:
> //
> -------------------------------------------------------------------------------------------------------------------
> myCube.name = "yaabbba dabbaaaa doooooo!";
> myCube.addEventlistener(MouseEvent3D.MOUSE_DOWN, getName);
> //
> -------------------------------------------------------------------------------------------------------------------
>
>
> //
> -------------------------------------------------------------------------------------------------------------------
> private function getName(e:MouseEvent3D):void
> {
> var myCube:Cube = e.target as Cube;
> or
> var myItem:* = e.target;
>
>
> trace(myCube.name);
> }
> //
> -------------------------------------------------------------------------------------------------------------------
>
>
>
>
>
> On 22 July 2010 08:53, le_unam <[email protected]> wrote:
>
>> yes but then i have the name and i cannot move the name right?
>>
>> the variable activeObject is type Object3D and if i go with
>> activeObject = myObject.name it is an error cause of changing the
>> type.
>> maybe activeObject has to be an other type?! But i want to move it
>> must be Object3D? I dont know :(
>>
>> On 22 Jul., 09:40, Darcey Lloyd <[email protected]> wrote:
>> > Already showed you how to get the object in my first post with the name.
>> >
>> > On 22 Jul 2010 06:27, "le_unam" <[email protected]> wrote:
>> >
>> > hey thank you for your reply, but the keyboardevents are no
>> > problem ... i got them ... my problem is how get my object by clicking
>> > on it to move.
>> >
>> > so i`ve got a variable activeObject and by clicking on any object i
>> > want to set activeObject = "anyObject" and want to be able to move it
>> > by keyboard. the mouseevent3d only gives me the position of the
>> > clicked object. but i need the object himself :-/
>> >
>> > On 21 Jul., 21:09, Darcey Lloyd <[email protected]> wrote:> More
>> of a question for basic AS3,...
>> > > AS3 Language ref for keycode can be found here:
>> >
>> > http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/e.
>> ..
>> >
>> >
>> >
>> > > <
>> http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/e...>
>> > > D
>> >
>> > > On 21 July 2010 14:21, le_unam <[email protected]> wrote:
>> >
>> > > > well i was a little fast ^^
>> >
>> > >...
>>
>
>