Flex的HSV to RGB ,RGB to HSV 算法
/*Copyright (c) 2006 Adobe Systems Incorporated
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
from, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
package qs.utils
{
public class ColorUtils
{
public static function HSVToRGB(hsv:Object):Number
{
var src:Object = hsv;
var dst:Number
var h:Number,s:Number,v:Number;
h = hsv.h;
s = hsv.s;
v = hsv.v;
var i:Number;
var f:Number, p:Number, q:Number, t:Number;
var r:Number,g:Number,b:Number;
if( s == 0 ) {
// achromatic (grey)
v = Math.floor(v*255);
dst = (v << 16) + (v << 8) + v;
return dst;
}
h /= 60; // sector 0 to 5
i = Math.floor( h );
f = h - i; // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
相关文档:
主程序代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
xmlns:mdi="ext.containers.windows.mdi.*"
width="100%"
height= ......
用Accordion组件的时候发现,child展开之后再点击的时候没有相应.
然后习惯性的Google发现解决方法大致是自定义一个组件...
感觉为了一个小功能重写有点 杀鸡用牛刀的感觉.
于是仔细想了下,发现其实只需要指定header的itemRenderer即可:
上代码 headerRenderer="com.MyAccHeader"
MyAccHeader:
package com
{
......
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
<mx:Script>
<![CDATA[
import mx.core.BitmapAsset;
import mx.core.DragSource;
import mx.events.DragEvent;
import mx.managers.DragManager;
private var xoffset:Number;
private var yoffset:Number;
priv ......
flex 页面跳转
方法一:使用navigateToURL
var url:String = "http://localhost/flex/test.jsp";
var request:URLRequest = new URLRequest(url);
navigateToURL(request,"_self");
方法二:引用flash中的 import flash.external.ExternalInterface 这个接口
他能提供像js中window.location.href方法一样方便
Extern ......