actionscript-3

As3 sprite rotationX and rotationY

主宰稳场 提交于 2020-01-02 18:57:09
问题 I have a bit problem with rotationX and rotationY. It's cool if i just do a roationX and rotaionY below _eventParent.rotationY =_differentX; _eventParent.rotationX =_differentY; However once i have assign a mouse move to the _eventParent. The roationX and roationY change perspectively while the mouse is moving. so instead the item remain the same size. it increase and decrease size prospectively. any idea why is it doing this? is there a possibility to stop this behavior? Thanks Please find

A* (A-star) implementation in AS3

时光怂恿深爱的人放手 提交于 2020-01-02 18:38:13
问题 I am putting together a project for a class that requires me to put AI in a top down Tactical Strategy game in Flash AS3. I decided that I would use a node based path finding approach because the game is based on a circular movement scheme. When a player moves a unit he essentially draws a series of line segments that connect that a player unit will follow along. I am trying to put together a similar operation for the AI units in our game by creating a list of nodes to traverse to a target

AS3 … (rest) parameter

蹲街弑〆低调 提交于 2020-01-02 13:55:10
问题 I've tested the following code: function aa(...aArgs):void { trace("aa:", aArgs.length); bb(aArgs); } function bb(...bArgs):void { trace("bb:", bArgs.length); } aa(); //calling aa without any arguments. The output is: aa: 0 //this is expected. bb: 1 //this is not! When I pass empty arguments (aArgs) to bb function; shouldn't it return 0 length? Seems like function bb is treating the passed aArgs as non-empty / non-null.. What am I missing here? Any help is appreciated. regards.. 回答1: It looks

Whats the appropriate form when dispatching events in AS3?

二次信任 提交于 2020-01-02 13:15:15
问题 I was wondering what the appropriate form was when creating custom events? Should one create a CustomEvent class, and then create a temporary dispatcher in the function, and dispatch the CustomEvent. or is it better to attempt to create a CustomEventDispatcher class, and create the CustomEvent class as an internal class of that class, eg: package { public class CustomEventDispatcher extends EventDispatcher { public function CustomEventDispatcher() { super(new CustomEvent()); } } } class

Binary search, from java to Actionscript

强颜欢笑 提交于 2020-01-02 12:42:30
问题 I am trying to convert the following java binary search routine to as3. I assume that 'compareTo' is a built in java method and that '>>>' s a type of bitwise operation. Can anyone familiar with both actionscript 3 and Java help with this? package binary; public class Finder { public static int find( String[ ] keys, String target) { int high = keys.length; int low = -1; while (high - low>1) { int probe = (low + high)>>> 1; if (keys[probe].compareTo(target) > 0) high = probe; else low = probe;

Fastest way to write to multiple socket connections

橙三吉。 提交于 2020-01-02 12:04:27
问题 I am using the following class to accept incoming connections from client applications - using the send function I want to write the same UTFBytes to each client at the same time - is this possible? or if not, what would be the fastest way to write to them sequentially. public class ProjectorClients { private var _serverSocket:ServerSocket; private var _clients:Vector.<Socket> = new Vector.<Socket>; private function ProjectorClients():void { _serverSocket = new ServerSocket(); _serverSocket

Custom “context menu” in flex

戏子无情 提交于 2020-01-02 10:33:17
问题 I would like to add a custom context menu with line separators, but can't really figure out how. What I need: <mx:List id="treeContextFile" visible="false" width="233" verticalScrollPolicy="off" includeInLayout="false"> <mx:dataProvider> <mx:Array > <mx:String>Open</mx:String> <horizontal line here > <mx:String>Cut</mx:String> <mx:String>Copy</mx:String> <mx:String>Paste</mx:String> <horizontal line here > <mx:String>Rename</mx:String> <mx:String>Delete</mx:String> <horizontal line here > <mx

AS3: Merging XML Files

£可爱£侵袭症+ 提交于 2020-01-02 10:18:11
问题 There are a number of posts on here about merging XML with Java, but I can't seem to find any reference to Actionscript for the same task. I have a group of XML files that I need to load. I want them to sort into one XML Object in memory. For example, let's say these were my XML files: File 1 <xml> <type name="1" group="a"> <unit> value1 </unit> </type> <type name="1" group="b"> <unit> value2 </unit> </type> <type name="2" group="a"> <unit> value3 </unit> </type> </xml> File 2 <xml> <type

Is it possible to dynamically create an instance of user-defined Class in Action Script 3?

北城余情 提交于 2020-01-02 09:10:35
问题 I got a factory, where Action Script follows an xml and builds DisplayObject hierarchy out of it. It is meant that script doesn't know beforehand what elements it will encounter in xml and therefore doesn't know what user-defined factory classes it will need. I know that it is possible to do something like this: var rect:*, className:String = "flash.geom.Rectangle"; if (ApplicationDomain.currentDomain.hasDefinition(className)) { rect = new(getDefinitionByName(className)); } And Rectangle

Load images into separate movie clips from a XML, Flash, Actionscript 3.0

对着背影说爱祢 提交于 2020-01-02 08:46:07
问题 I have an xml image bank, pretty standard, and I have a loader, along with movie clips that I want the images loaded into, the problem that I am running into is I want the images to load into separate movie clips, so I’m using a case statement to specify where they go. However, I can only get them to load into a single movie clip, I assume they are loading ontop of each other and I don’t know how to get them to separate out. I’ll post my code. It doesn’t make any sense to me but if you have