获取Obj变量地图

获取Obj上的所有public属性,可以用于两个对象的属性的快速匹配,详情请见 flash.utils.describeType 方法的API [codesyntax lang=”actionscript3”]

public function initParams(obj:Object):void{
this.paramVo = new ParamsVo();
var obj:Object = getVariablesMapObj(paramVo);
for(var i:String in obj){
trace(i);
if(obj.hasOwnProperty(i)){
paramVo[i] = obj[i];
}
}
}

/**
* 获得变量地图
* @param target
* @return
*
*/
private function getVariablesMapObj(target:Object):Object
{
var obj:Object = new Object();
var dt:XML=describeType(target);
for each(var node:XML in dt.variable)
{
obj[node.@name] = node.@type;
}
return obj;
}

[/codesyntax]

在mxml中addChild一个sprite

在flex项目中讲一个没有继承UIComponent的flash的DisplayObject加载(addChild)到舞台上 [codesyntax lang=”actionscript3”]

<s:Application name=”Spark_SpriteVisualElement_addChild_test”
xmlns:fx=”http://ns.adobe.com/mxml/2009"
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/halo”
initialize=”init();”>

<fx:Script>
    <!\[CDATA\[
        private spr1:Sprite = new Sprite();

        private function init():void {
            spr1.graphics.beginFill(0xFF0000, 0.5);
            spr1.graphics.drawRect(10, 10, 100, 80);
            spr1.graphics.endFill();
            con.addChild(spr1);
        }
    \]\]>
</fx:Script>

<s:SpriteVisualElement id="con" />

[/codesyntax]

php+mysql分页练习

php+mySql 分页练习 1.$url = $_SERVER[‘REQUEST_URI’]; 2.$page = $_GET[page]; 3.SELECT * FROM `message` limit $pageindex $pageSize   [codesyntax lang=”php”]

= $total ? $total -1 : $page; $pageindex = $page \* $pageSize; $pageindex .= ","; } $url = $\_SERVER\['REQUEST\_URI'\]; $url = parse\_url($url); $url = $url\[path\]; echo "上一页" . "  下一页"; $sql = "SELECT \* FROM \`message\` limit $pageindex $pageSize"; $r = mysql\_query($sql); echo " 总页数" . $total . "

"; while ($ss = mysql\_fetch\_array($r)) { echo $ss\[user\] . "

"; } ?>

[/codesyntax]

as3.0 用代码设置“调整颜色”滤镜--------即:亮度、对比度、饱和度、色相的调整

相信大家对滤镜这东西,在flash IDE内应用很熟吧?但是在as内怎么用代码实现呢?这个问题还别说,起初真有点犯难,后经高手指点,逐一化解。经验不敢独享,故与大家分享(高手可掠过)。如有疑问,请多多提出咯……   import fl.motion.ColorMatrix; import flash.filters.ColorMatrixFilter;   //**调整亮度**// var ld_Matrix:ColorMatrix=new ColorMatrix(); var ld_Filter:ColorMatrixFilter=new ColorMatrixFilter(); ld_Matrix.SetBrightnessMatrix(100);  //设置亮度值,值的大小是 -255–255   0为中间值,向右为亮向左为暗。 ld_Filter.matrix = ld_Matrix.GetFlatArray(); ld_MC.filters = [ld_Filter]; //ld_MC.filters = [];//去除滤镜   //**调整对比度**// var db_Matrix:ColorMatrix=new ColorMatrix(); var db_Filter:ColorMatrixFilter=new ColorMatrixFilter(); db_Matrix.SetContrastMatrix(255);  //设置对比度值,值的大小是 -255–255  127.5为中间值,向右对比鲜明向左对比偏暗。 db_Filter.matrix = db_Matrix.GetFlatArray(); db_MC.filters = [db_Filter]; //db_MC.filters = [];//去除滤镜   //**调整饱和度**// var bh_Matrix:ColorMatrix=new ColorMatrix(); var bh_Filter:ColorMatrixFilter=new ColorMatrixFilter(); bh_Matrix.SetSaturationMatrix(0);  //设置饱和度值,值的大小是 -255–255   1为中间值,0为灰度值(即黑白相片)。 bh_Filter.matrix = bh_Matrix.GetFlatArray(); bh_MC.filters = [bh_Filter]; //bh_MC.filters = [];//去除滤镜   //**调整色相**// var sx_Matrix:ColorMatrix=new ColorMatrix(); var sx_Filter:ColorMatrixFilter=new ColorMatrixFilter(); sx_Matrix.SetHueMatrix(1);  //设置色相值,值的大小是 -255–255  0为中间值,向右向左一试便知。 sx_Filter.matrix = sx_Matrix.GetFlatArray(); sx_MC.filters = [sx_Filter]; //sx_MC.filters = [];//去除滤镜   原文链接:http://bbs.9ria.com/space.php?uid=112507&do=blog&id=12944