2010年12月25日 星期六

DisplayObject.mask屬性 + MouseEvent.MOUSE_WHEEL事件 + MouseEvent.delta屬性

↓ 最好點擊此連結至新視窗瀏覽,以避免滾動滑鼠滾輪時,受此頁面捲軸捲動之干擾
991224_DisplayObject.mask.swf




import flash.text.TextField;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextFormat;

//
var format:TextFormat = new TextFormat();
with(format){
 color = 0xbbbbbb;
 size = 18;
 bold= true;
}
//
var tf:TextField = new TextField();
with(tf){
 defaultTextFormat = format;
 text = "I know I know, Keith’s probably shaking his head right now (because I continue to make apps for the Apple products) and right now I’m beyond pissed off. I submitted the update to Shell Shock (paid, then free version – in that order) to the review queue on Nov 17th. The FREE version, which was submitted AFTER the paid version, was reviewed in 30 minutes and approved. The Paid version FINALLY went into review last Wednesday ( 2weeks later ) and has been there ever since… IN REVIEW. Then I received a notice that apple needed more time to review my app. I asked “why?” – and got the customary form letter back. I asked “Why?” again, and again, I got a form letter back. So I’ve written another email today (another rant) and am now asking for a phone number or someone I can actually “talk” to at Apple. I doubt they’ll pony up that information btw. Seems crazy that I’m giving them 30% and bending over backwards to cater to “their” ideals when it comes to creating the software, but when it comes to *my* ideals (you know, crazy stuff like approvals in a reasonable amount of time and IN ORDER that they were submitted), they’re ignoring me (duh, what else is new) So, is there anyone out there with a phone number or email contact that I don’t already know about that I can call and complain?";
 multiline = true;
 wordWrap = true;
 width = 550;
 autoSize = TextFieldAutoSize.LEFT;
 selectable = false;
}

addChild(tf);

//
var myCircle:Sprite = new Sprite();
var radius:int = 150;
var posX:int = stage.stageWidth/2;
var posY:int = stage.stageHeight/2;

//
//beginFill(color:uint, alpha:Number = 1.0):void
//指定簡單的單色填色,後續在繪製時呼叫其它 Graphics 方法 (例如 lineTo() 或 drawCircle()) 便可以使用此填色
with(myCircle.graphics){
 beginFill(0xff0000, 1.0); 
 drawCircle(posX,posY,radius);
 endFill();
}
//
addChild(myCircle);
//開啟按鈕模式
myCircle.buttonMode = true;
//不用手形指標
//myCircle.useHandCursor = false;

//
addChild(txt);
//

myCircle.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag);
myCircle.addEventListener(MouseEvent.MOUSE_UP, endDrag);
stage.addEventListener(MouseEvent.MOUSE_WHEEL, wheel);
//
function beginDrag(e:MouseEvent = null):void{
 tf.mask = myCircle;
 e.currentTarget.startDrag();
}
//
function endDrag(e:MouseEvent = null):void{
 tf.mask = null;
 e.currentTarget.stopDrag();
}
//
function wheel(e:MouseEvent):void{
 //
 stage.focus = myCircle;
 trace(e.delta);
 radius += (e.delta)*4;
 with(myCircle.graphics){
  clear();
  beginFill(0xff0000, 1.0); 
  drawCircle(posX,posY,radius);
  endFill();
 }
}

沒有留言: