Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Actionscript 3 Help

Name: Anonymous 2013-04-17 19:29

ACTIONSCRIPT 3 Help

I am trying to have a player move to a point where I click on the scene. Is there a way to do with without referencing an external .AS file?

I tried simply removing the packaging and the 'public' from in front of the variables and functions, but I get Conductor errors.

What I have:
package {

import flash.display.MovieClip;
import flash.events.*;

public class Walk extends MovieClip{

public var player:MovieClip = new MovieClip();
public var walkRate = 10;
public var targetBuffer = 10;

public function Walk(){

player = new circle;
addChild(player);
player.x = 200;
player.y = 200;

stage.addEventListener(MouseEvent.CLICK, goToPoint);

} // end Walk function

public function goToPoint(e:MouseEvent):void{
player.targetx = mouseX;
player.targety = mouseY;
player.addEventListener(Event.ENTER_FRAME, movePlayer);
}

public function movePlayer(e:Event):void{
var increments:Array = new Array();
increments = getIncrements(player.targetx, player.targety);

var xinc = increments[0];
var yinc = increments[1];

player.x += xinc;
player.y += yinc;


if ((player.x > (player.targetx-targetBuffer) && player.x < (player.targetx+targetBuffer)) && (player.y > (player.targety-targetBuffer) && player.y < (player.targety+targetBuffer))){
player.removeEventListener(Event.ENTER_FRAME, movePlayer);
}

}


public function getIncrements(thisX, thisY):Array{
var increments:Array = new Array();
var xdiff = (thisX - player.x);
var ydiff = (thisY - player.y);
var diff = Math.sqrt(Math.pow(xdiff, 2) + Math.pow(ydiff, 2));
var fraction = 10/diff;
var xinc = fraction*xdiff;
var yinc = fraction*ydiff;

increments.push(xinc, yinc, diff);

return increments;

}

}

}

Name: Mentifex Addendum Codicil 2013-04-18 7:19

For Web-posting of new memes, venue matters little,
and then only to put a special slant on things.
If people are searching you out and automatically
receiving reports of your Web activities, then you
can post anywhere on the Web, and your ideas will
automatically be disseminated to your target audience --
and then some (spook agencies; grudge-holders; relatives et al.).

http://groups.google.com/group/alt.memetics/msg/ab71805a317d0cd5

Name: Anonymous 2013-04-18 7:39

you forgot a semicolon

Name: Anonymous 2013-04-18 7:48

have you tried using an [b][u]ENTERPRISE QUAL[/b][/u]scratch that...
have you worked through the Copy and Paste of Computer Programs (CPCP)? try searching `double CP'

Name: Anonymous 2013-04-18 18:42



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-18 18:47



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Name: Anonymous 2013-04-18 18:53



Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop


Searching for legit Microsoft Product keys, Windows 8,7,Studio,Server etc.?

 Mail me at jeremiahgoldstein@hotmail.com

 25$ a pop

Don't change these.
Name: Email:
Entire Thread Thread List