我试图构建一个微小的(或者可能不是那么小)的公式,它将包含一组min和max之间的数字,但也会循环这些数字,这样如果它们超出范围就不会被剪裁.到目前为止,这就是我所拥有的.
min1 = 10
max1 = 90
val1 = 92
//will make 11, which is what i want since it loops
formula: min(max(min1,min(val1,max1)),mod(val1,max1)+min1)
Run Code Online (Sandbox Code Playgroud)
但是,我希望它也可以循环另一个方向,这样如果val1为5,即min1之外的-5,它将变为86.
我遇到的另一个问题是
max1 % max1 != max1
Run Code Online (Sandbox Code Playgroud)
因为我想要它,因为最大值是范围的一部分
试图说清楚,这里有一些基于循环范围的所需输出的例子
min1 = 10
max1 = 90
----------------------------------------------
val1 = 30 //within range: stays as 30
val1 = 90 //within range: stays as 90
val1 = -6 //below range: loops to becomes 75
val1 = 98 //above range: loops to becomes 17
val1 = 91 //above range: loops to …Run Code Online (Sandbox Code Playgroud) 有没有一种常用的方法将Flash Professional中绘制的矢量图形转换为Drawing API的代码?
这些绘制或导入的矢量图形资源的代码在源文件(.xfl)中作为XML数据提供.例如,以下绘制的矢量图形是尾随的XML数据.

<DOMSymbolItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ns.adobe.com/xfl/2008/" name="MSprite" itemID="4e03ae4f-00002c0f" linkageExportForAS="true" linkageBaseClass="flash.display.Sprite" linkageClassName="MSprite" sourceLibraryItemHRef="Symbol 1" lastModified="1308864079" isSpriteSubclass="true">
<timeline>
<DOMTimeline name="MSprite">
<layers>
<DOMLayer name="Layer 1" color="#4FFF4F" current="true" isSelected="true">
<frames>
<DOMFrame index="0" keyMode="9728">
<elements>
<DOMShape>
<fills>
<FillStyle index="1">
<SolidColor color="#00CCFF"/>
</FillStyle>
</fills>
<strokes>
<StrokeStyle index="1">
<SolidStroke scaleMode="normal">
<fill>
<SolidColor/>
</fill>
</SolidStroke>
</StrokeStyle>
</strokes>
<edges>
<Edge fillStyle0="1" strokeStyle="1" edges="!6883 745S5[6369 340 5741 148!5741 148[5534 85 5314 78!5314 78[4037 36 2754 2!2754 2[1956 -18 1222 211!1222 211[693 376 393 745!393 745[139 1056 48 1512!48 1512[-130 …Run Code Online (Sandbox Code Playgroud) 请参阅下面的快速图表.
我要做的是通过使用红点已知坐标的角度来获取黄点的坐标.假设每个黄点距离x:50/y约20个像素:直角250个红点(我认为这就是所谓的)我如何得到它们的坐标?
我相信这是非常基本的三角学,我应该使用Math.tan(),但他们并没有在艺术学校教我们太多的数学.
alt text http://www.freeimagehosting.net/uploads/e8c848a357.jpg
我刚开始使用Google Maps API for Flash(map_1_20.swc)为我正在使用Flash CS5构建的AIR 2.5应用程序.一切都加载并在ADL中显示正常,除了我收到安全沙箱违规:
*** Security Sandbox Violation ***
SecurityDomain 'http://maps.googleapis.com/mapsapi/publicapi?
file=flashapi&url=http%3A%2F%2FgMyDomainName.com&key=ABQIAAAAKlbBGDLCUgZLtxxJ6-
Hi9RQ7KOBhSjQi3kzVUu2XaSyicmBCGxQz68ixtUMxnYSMDFuMNT0cJYPwjQ&sensor=false&v=1.20&fl
pub=&flh=17e8cb187dcf0488fac63df6b16432b7592443ee&flc=at&flcl=a0g30ufvvrvvtvvbo03'
tried to access incompatible context 'app:/MapTest.swf'
//MyDomainName.com represents my domain registered with the API key
Run Code Online (Sandbox Code Playgroud)
当鼠标进入或退出infoWindow时,抛出安全沙箱违规.
这是我的文档类代码
package
{
import com.google.maps.LatLng;
import com.google.maps.InfoWindowOptions;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import flash.display.Sprite;
import flash.events.Event;
public class MapTest extends Sprite
{
public function MapTest()
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(evt:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
var map:Map = new Map();
map.key = "ABQIAAAAKlbBGDLCUgZLtxxJ6-Hi9RQ7KOBhSjQi3kzVUu2XaSyicmBCGxQz68ixtUMxnYSMDFuMNT0cJYPwjQ";
map.url = "http://MyDomainName.com"; …Run Code Online (Sandbox Code Playgroud) 我想问一下air.File.documentsDirectory.resolvePath,File.userDirectory.resolvePath,air.File.applicationDirectory.resolvePath之间的区别.
任何人都可以解释文件何时存储.....
特别是在窗户
据我所知,它可能链NPM脚本用&&,pre-和post-挂钩,但它可以简单地冗长的台词分离成单个,串联线?
例如,我想转换这个:
"script": {
"build": "--many --commands --are --required --on --a --single --line"
}
Run Code Online (Sandbox Code Playgroud)
进入这个:
"script": {
"part1": "--many --commands",
"part2": "--are --required",
"part3": "--on --a",
"part4": "--single --line",
"build": "part1 + part2 + part3 + part4"
}
Run Code Online (Sandbox Code Playgroud)
因此,当我输入npm run build它时,将命令的所有部分合并在一行上.
我也熟悉配置变量,但它们不是跨平台解决方案,因此我将避免使用它们.
我的测试字符串包含一个方括号和一个闭合方括号的4个实例,因此我希望以下正则表达式返回4个匹配项,但只返回1个匹配项。
const test = "sf[[[[asdf]]]]asdf"
const regExp = new RegExp(/^.*\[.*\].*$/, "g");
const matches = test.match(regExp).length;
console.log(matches);
Run Code Online (Sandbox Code Playgroud) 问题1:现代计算机语言究竟是如何形成的?为什么?他们如何开始,谁是他们的背后?
问题2:如果有的话,目前处于婴儿期的哪些语言有希望?
如何将长度转换为-1.0到1.0范围内的值?
示例:我的舞台长度为440px并接受鼠标事件.我想在舞台中间点击,而不是输出X = 220,我希望它是X = 0.同样,我想真正X = 0成为X = -1.0与现实X = 440成为X = 1.0.
我无法访问舞台,因此我不能简单地对其进行居中注册,这将使这个过程变得更加容易.此外,无法动态更改舞台的实际大小,因此我正在寻找一个公式,将鼠标的舞台的实际X坐标平移到-1到1的范围内.
我的理解是,对于垃圾收集,类的原始类型(uint,string,Number等)不需要设置为null.
例如,我不需要dispose()在以下类中编写此方法:
package
{
//Imports
import flash.display.Shape;
//Class
public class DrawSquare extends Shape
{
//Properties
private var squareColorProperty:uint;
//Constructor
public function DrawSquare(squareColor:uint)
{
squareColorProperty = squareColor;
init();
}
//Initialize
private function init():void
{
graphics.beginFill(shapeColorProperty);
graphics.drawRect(0, 0, 200, 200);
graphics.endFill();
}
//Dispose
public function dispose():void
{
squareColorProperty = null;
}
//Get Shape Color
public function get squareColor():uint;
{
return squareColorProperty;
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果这是真的,我相信它是什么,原始类型的对象和非原始类型的对象有关内存分配的区别是什么?
garbage-collection memory-management actionscript-3 primitive-types
math ×3
air ×2
flash ×2
javascript ×2
range ×2
coordinates ×1
file-io ×1
google-maps ×1
graphics ×1
location ×1
module ×1
node.js ×1
npm ×1
regex ×1
storage ×1
translation ×1
trigonometry ×1
xml ×1