View Mode: Normal | Article List
flash as3: copyChannel
[ 2010-08-19 11:09:23 | Author: liuhuan ]
var bmp:BitmapData = new BitmapData(mOriginal.width, mOriginal.height, true);
bmp.draw(mOriginal);
var b = new BitmapData(mOriginal.width, mOriginal.height, true, 0xff000000);
var r = new BitmapData(mOriginal.width, mOriginal.height, true, 0xff000000);
var g = new BitmapData(mOriginal.width, mOriginal.height, true, 0xff000000 );
b.copyChannel(bmp,
...bmp.draw(mOriginal);
var b = new BitmapData(mOriginal.width, mOriginal.height, true, 0xff000000);
var r = new BitmapData(mOriginal.width, mOriginal.height, true, 0xff000000);
var g = new BitmapData(mOriginal.width, mOriginal.height, true, 0xff000000 );
b.copyChannel(bmp,
Read More...
AS3: Simple email validation
[ 2010-08-12 14:25:21 | Author: liuhuan ]
function validate(param1:TextField):Boolean {
if (param1.text.length >= 7) {
if (param1.text.indexOf("@") > 0) {
if (param1.text.indexOf("@") + 2 < param1.text.lastIndexOf(".")) {
if (param1.text.lastIndexOf(".") < param1.text.length - 2) {
return true;
}
}
}
}
return false;
}
if (param1.text.length >= 7) {
if (param1.text.indexOf("@") > 0) {
if (param1.text.indexOf("@") + 2 < param1.text.lastIndexOf(".")) {
if (param1.text.lastIndexOf(".") < param1.text.length - 2) {
return true;
}
}
}
}
return false;
}
AS3: hitTestPoint
[ 2010-08-12 14:14:05 | Author: liuhuan ]
A small example showing how hitTestPoint works in ActionScript 3.0.
var hitResult:Boolean;
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
function onEnterFrameHandler(e:Event) {
if (mLeft.hitTestPoint(mouseX, mouseY, true) ) {
hitResult = true;
} else if (mRight.hitTestPoint(mouseX, mouseY, false) ) {
...this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
function onEnterFrameHandler(e:Event) {
if (mLeft.hitTestPoint(mouseX, mouseY, true) ) {
hitResult = true;
} else if (mRight.hitTestPoint(mouseX, mouseY, false) ) {
Read More...
AS3: bitmapdata threshold example
[ 2010-08-10 14:30:00 | Author: liuhuan ]
Is there any magic wand tool we can use in Flash? ActionScript 3 provides us a method called threshold. Codes below:
function applyThreshold(mc:MovieClip) {
var NewBitmpapData:BitmapData = new BitmapData(mc.width, mc.height, true, 0);
NewBitmpapData.draw(mc);
var pt:Point = new Point(0, 0);
var NewRect:Rectangle = new
...var NewBitmpapData:BitmapData = new BitmapData(mc.width, mc.height, true, 0);
NewBitmpapData.draw(mc);
var pt:Point = new Point(0, 0);
var NewRect:Rectangle = new
Read More...
http://www.aswing.org/ (Chinese site: http://cn.aswing.org/ )...
Read More...
Quote
AsWing is an Open Source Flash ActionScript GUI framework and library that allows programmers to make their flash application(or RIA) UI easily. Its usage is similar to Java Swing. It provides a set of GUI components, which we intent to implement in pure object oriented ActionScript 2. A pluggable look and feel will be
Read More...
Copy text into clipboard in flash (as2, as3)
[ 2010-07-17 14:58:43 | Author: liuhuan ]
System.setClipboard("something");
as2: export JEPG with flash/ASP/PHP
[ 2010-06-12 16:53:36 | Author: liuhuan ]
3d carousel
[ 2010-06-12 09:48:41 | Author: liuhuan ]
It's long time since i played with PV3D.
package {
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.view.BasicView;
import org.papervision3d.core.proto.*;
...import flash.display.*;
import flash.events.*;
import flash.filters.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.view.BasicView;
import org.papervision3d.core.proto.*;
Read More...









