Skip to content

Instantly share code, notes, and snippets.

View lynxerzhang's full-sized avatar
🤒

frankwinter lynxerzhang

🤒
  • geckostudio
  • shanghai
View GitHub Profile
/**
*
*
* ScaleBitmap
*
* @author Didier Brun
* @author Jerôme Decoster
* @version 1.1
*
*/
@lynxerzhang
lynxerzhang / GNU License
Created March 16, 2012 03:01
about GNU License
Monster Debugger is released under the GNU General Public License.
and GrantSkinner's document said this license is a "viral" license,
and our project use the debug tool, so...
@lynxerzhang
lynxerzhang / bitmapscale9btn
Created March 16, 2012 03:55
bitmapscale9btn(like movieclip's scale9Grid property)
/**
*
* all code in timeline
* bitmapbutton test
*
* our project use raw bitmap to install button, so more btn resource is repeat
* use ScaleBitmap to reuse resource(like movieclip's scale9Grid)
*/
import org.bytearray.display.ScaleBitmap;
import org.bytearray.display.ScaleBitmapSprite;
@lynxerzhang
lynxerzhang / JFrame is not GC ??
Created March 16, 2012 10:00
garbage collection in aswing framework
//create a frame
var f:JFrame = new JFrame(this);
//......
//some children add in this JFrame
f.show();
//......
//and final we dispose it
f.closeReleased(); //this method will call it's dispose() method
f = null;
@lynxerzhang
lynxerzhang / gskinner's js motion library
Created March 28, 2012 01:32
GrantSkinner's JS motion library
http://gskinner.com/blog/archives/2012/03/announcing-createjs.html
GrantSkinner's great job, and look at Zoë library, "It’s also worth mentioning here that Flash Pro CS6 will include direct support for exporting sprite sheets for EaselJS, offering a more integrated workflow than Zoë can provide."
@lynxerzhang
lynxerzhang / use cacheAsBitmap very carefully
Created April 16, 2012 06:50
about displayobject's cacheAsBitmap and updateAfterEvent
this is a case:
In a very large-size Movieclip (as a game 'map', roughly 4000(width) * 2000(height)), set this movieclip's property 'cacheAsBitmap' to true, and this mc has dozen children, when you start drag this mc, you could obviously feel 'mousemove' is not smooth, Even if you register the mousemove listener and handle 'updateAfterEvent' method. drag mc is still not smooth. (and worse the fps is slower).
so read adobe's API documentation, found the 'cacheAsBitmap' property has some pay attention points...
"The cacheAsBitmap property is best used with movie clips that have mostly static content and that do not scale and rotate frequently. "
so I think this maybe the reason why above example's mc drag is not smooth, because internal children is change it's propery(like, 'rotation' "x", "y") will handle entire root mc to recreate the bitmap cache. and the mouseEvent's method
'updateAfterEvent' will enforce flashplayer to redraw immediately in every mouseMove operation.
@lynxerzhang
lynxerzhang / rotateBits.as
Last active October 3, 2015 05:18
Rotate bits function
//TODO
function rotateBits(values:uint, extent:int):uint{
var offset:uint;
const bytesAll:int = 32;
if(extent == 0){
return values;
}
extent = extent % bytesAll;
if(extent > 0){
offset = values >>> (32 - extent);
@lynxerzhang
lynxerzhang / readBits.as
Last active October 3, 2015 14:28
read specified bits in byteArray
/**
* study from byteArray.org(about a as3 byteArray's Book)
*/
import flash.utils.ByteArray;
var b:ByteArray = new ByteArray();
b.writeUnsignedInt(1234);
b.writeUnsignedInt(uint.MAX_VALUE);
b.position = 0;
@lynxerzhang
lynxerzhang / c point study
Created April 24, 2012 14:07
c point study -- (exchange two variable value)
/**
* The c point study notes
* below is a exchange two specified variable value case
*/
//this function is do not return any value
//the two parameter is a pointer variable of type int
void exchangeNum(int *num1, int *num2){
int t = *num1;
*num1 = *num2;
@lynxerzhang
lynxerzhang / Text Component is unable set TextFormat?
Created April 28, 2012 04:54
Bit101's Text Component is Unable set the TextFormat?
//I use Bit101's Component framework(Window, Text, PushButton) to create a Alert Component
/**
* create a window and set size (this window couldn't be drag)
*/
var alert:Window = new Window(this, 0, 0, "Alert");
alert.draggable = false;
alert.setSize(300, 200);
/*