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, but here is an example typed directly into
> email, so there may be typos.
>
> var myGreateBigCube:Cube = new Cube();
> view.scene.addChild(myGreateBigCube);
>
> stage.addEventListener (KeyboardEvent.KEY_DOWN,
> AFunctionThatHandlesKeyDownEvents);
> stage.addEventListener (KeyboardEvent.KEY_UP,
> AnotherFunctionThatHandlesKeyUpEvents);
>
> function AFunctionThatHandlesKeyDownEvents(e:KeyboardEvent):void {
> trace("Key code pressed: " + e.keyCode );
>
> swtich(e.keyCode){
>
> case <insert keycode value for left here>:
> myGreateBigCube.x -= 1;
> break;
>
> case <insert keycode value for right here>:
> myGreateBigCube.x += 1;
> break;
>
> } // end case
> } // end function
>
> function AnotherFunctionThatHandlesKeyUpEvents(e:KeyboardEvent):void {
>
> }
>
> 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 ^^
>
> > now i can get the name but this doesnt help because i want to change
> > the position of the clicked object. sorry now i realize i told you not
> > the details before. All i want to do is to change the position of the
> > clicked object with the arrow keys. So how can i get access to the
> > object.
>
> > On 21 Jul., 15:00, Darcey Lloyd <[email protected]> wrote:
> > > Try:
>
> > > //
>
> ------------------------------------------------------------------------------------------------------------------->
>  > myCube.name = "yaabbba dabbaaaa doooooo!";
> > > myCube.addEventlistener(MouseEvent3D.MOUSE_DOWN, getName);
> > > //
>
> -------------------------------------------------------------------------------------------------------------------
>
> > > //
>
> ------------------------------------------------------------------------------------------------------------------->
>  > private function getName(e:MouseEvent3D):void
> > > {
> > >    var myCube:Cube = e.target as Cube;
> > >    trace(myCube.name);}
>
> > > //
>
> -------------------------------------------------------------------------------------------------------------------
>
>
>
> > > D
>
> > > On 21 July 2010 13:20, le_unam <[email protected]> wrote:
>
> > > > Hey guys how to receive the name of an object? i think mouseevent3d
> > > > must be the right way but i dont know the details.
>
> > > > when i create a cube with the name myCube and i want to trace the name
> > > > of the cube when i click on it ...
>
> > > > myCube.addEventlistener(MouseEvent3D.MOUSE_DOWN, getName);
>
> > > > ---------------------------------------
> > > > function getName(e:MouseEvent3D):void
> > > > {
> > > >        trace(e.object);
> > > > }
> > > > ---------------------------------------
>
> > > > i tried some things like this but nothing will work. whats the right
> > > > way?
>
> > > > greetz

Reply via email to