http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/WaitForLayoutManager.as ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/WaitForLayoutManager.as b/mustella/src/main/flex/WaitForLayoutManager.as new file mode 100644 index 0000000..eb47945 --- /dev/null +++ b/mustella/src/main/flex/WaitForLayoutManager.as @@ -0,0 +1,205 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package { + +import flash.display.DisplayObject; +import flash.display.IBitmapDrawable; +import flash.utils.*; +import flash.net.*; +import flash.events.*; +import flash.display.*; +import flash.geom.Matrix; + +/** + * WaitForLayoutManager - waits for LayoutManager to complete validation + * MXML attributes: + * timeout (optional) + */ +public class WaitForLayoutManager extends TestStep +{ + + private var eventListenerListening:Boolean = false; + + + /** + * Test the value of a property, log result if failure. + */ + override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean + { + + this.root = root; + this.context = context; + this.testCase = testCase; + this.testResult = testResult; + + waitEvent = eventName; + waitTarget = target; + + + var actualTarget:Object = context.stringToObject(target); + if (actualTarget) + { + if (actualTarget.isInvalid()) + { + actualTarget.addEventListener(eventName, eventListener); + eventListenerListening = true; + } + else + { + return true; + } + } + + + if (numEvents < numExpectedEvents ) + { + + testCase.setExpirationTime (getTimer() + timeout); + if (!eventListenerListening) + { + actualTarget.addEventListener(eventName, eventListener); + eventListenerListening = true; + testCase.cleanupAsserts.push(this); + } + doStep(); + waitEvent = eventName; + waitTarget = target; + return false; + } + else + { + testCase.setExpirationTime (0); + stepComplete(); + return true; + } + + return super.execute(root, context, testCase, testResult); + } + + + /** + * Test the value of a property, log result if failure. + */ + override protected function doStep():void + { + var actualTarget:Object = context.stringToObject(target); + if (!actualTarget) + { + testResult.doFail("Target " + target + " not found"); + return; + } + + } + + public function doTimeout ():void + { + testResult.doFail("Timeout waiting for " + waitEvent + " on " + target); + + } + + /** + * The object to set a property on + */ + private var target:String = "mx.core::UIComponentGlobals.mx_internal:layoutManager"; + + /** + * The event to wait for + */ + private var eventName:String = "updateComplete"; + + /** + * Storage for numEvents + */ + protected var numEvents:int = 0; + + /** + * Number of expected events (must be > 0), use AssertNoEvent for 0. + * Set to -1 if you want to see at least one event and don't care if there's more. + */ + public var numExpectedEvents:int = 1; + + /** + * The event object + */ + private var lastEvent:Event; + + /** + * The event listener + */ + protected function eventListener(event:Event):void + { + testCase.setExpirationTime(0); + + lastEvent = event; + numEvents++; + + waitEventHandler (event); + + } + + /** + * Test the value of a property, log result if failure. + */ + public function cleanup():void + { + var actualTarget:Object = context.stringToObject(target); + if (actualTarget) // might be null if object was killed + actualTarget.removeEventListener(eventName, eventListener); + } + + /** + * customize string representation + */ + override public function toString():String + { + var s:String = "WaitForLayoutManager"; + return s; + } + + /** + * The method that gets called back when the event we're waiting on fires + */ + override protected function waitEventHandler(event:Event):void + { + + // we can rely on eventListener to update lastEvent and numEvents + + // keep waiting if there aren't enough events + if (numExpectedEvents != -1 && numEvents < numExpectedEvents) + { + return; + } + + if (numExpectedEvents == numEvents) + { + cleanup(); + testCase.setExpirationTime (0); + stepComplete(); + return; + + } + + waitEvent = eventName; + waitTarget = target; + super.waitEventHandler(event); + + } +} + +}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/WaitForSandboxApp.as ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/WaitForSandboxApp.as b/mustella/src/main/flex/WaitForSandboxApp.as new file mode 100644 index 0000000..099b133 --- /dev/null +++ b/mustella/src/main/flex/WaitForSandboxApp.as @@ -0,0 +1,106 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package { + +import flash.display.DisplayObject; +import flash.utils.getTimer; + +import mx.core.mx_internal; +use namespace mx_internal; + +/** + * The test step that sets a property to some value + * MXML attributes: + * target + * timeout (optional); + */ +public class WaitForSandboxApp extends TestStep +{ + /** + * @private + */ + override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean + { + super.execute(root, context, testCase, testResult); + return false; + } + + /** + * Set the target's property to the specified value + */ + override protected function doStep():void + { + var actualTarget:Object = context.stringToObject(target); + if (!actualTarget) + { + testResult.doFail("Target " + target + " not found"); + return; + } + + UnitTester.callback = waitForApp; + + testCase.setExpirationTime(getTimer() + timeout); + } + + private function waitForApp():void + { + + var actualTarget:Object = context.stringToObject(target); + if (actualTarget.bytesLoaded < actualTarget.bytesTotal) + { + UnitTester.callback = waitForApp; + return; + } + + try + { + var e:MustellaSandboxEvent = new MustellaSandboxEvent(MustellaSandboxEvent.APP_READY); + actualTarget.contentHolder.contentLoaderInfo.sharedEvents.dispatchEvent(e); + if (e.obj) + { + testCase.setExpirationTime(0); + stepComplete(); + } + else + UnitTester.callback = waitForApp; + } + catch (e:Error) + { + UnitTester.callback = waitForApp; + } + } + + /** + * The SWFLoader that loads the untrusted app + */ + public var target:String; + + /** + * customize string representation + */ + override public function toString():String + { + var s:String = "WaitForSandboxApp"; + if (target) + s += ": target = " + target; + return s; + } +} + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/WaitForWindow.as ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/WaitForWindow.as b/mustella/src/main/flex/WaitForWindow.as new file mode 100644 index 0000000..2a2caec --- /dev/null +++ b/mustella/src/main/flex/WaitForWindow.as @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package { + +import flash.display.DisplayObject; +import flash.net.*; +import flash.events.Event; + +[Mixin] +/** + * A "marker" class that causes test scripts to write out + * bitmaps to the urls instead of reading and comparing + * so that baselines/reference-points can be created for + * future comparing. + */ +public class WaitForWindow +{ + + /** + * Mixin callback that gets everything ready to go. + * The UnitTester waits for an event before starting + */ + public static function init(root:DisplayObject):void + { + UnitTester.waitForWindow = "myWhatever"; + } + + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/imageDiff.mxml ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/imageDiff.mxml b/mustella/src/main/flex/imageDiff.mxml new file mode 100644 index 0000000..f53112d --- /dev/null +++ b/mustella/src/main/flex/imageDiff.mxml @@ -0,0 +1,444 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" initialize="initLC()" width="800" > + + <mx:Script> + <![CDATA[ + import mx.controls.Label; + import mx.core.UIComponent; + + private var results:UIComponent; + private var contButton:Button; + + + private var isConnected:Boolean = false; + + private var connection:LocalConnection; + private var commandconnection:LocalConnection; + + private var digits:Array = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; + + private function initLC():void + { + for (var i:int = 0; i < 16; i++) + { + for (var j:int = 0; j < 16; j++) + { + byteTable[digits[i] + digits[j]] = i * 16 + j; + } + } + percentWidth = 100; + percentHeight = 100; + + connection = new LocalConnection(); + connection.allowDomain("*"); + connection.client = this; + + commandconnection = new LocalConnection(); + commandconnection.allowDomain("*"); + commandconnection.addEventListener(StatusEvent.STATUS, statusHandler); + + connect(); + } + + private function connect():void + { + try + { + connection.connect("_ImageDiffer"); + } + catch (e:Error) + { + trace("connection failed"); + } + } + + private function statusHandler(event:Event):void + { + isConnected=true; + } + + private var sbd:BitmapData; + private var sba:ByteArray; + [Bindable] private var scriptName:String = ""; + [Bindable] private var testName:String = ""; + // public function startScreenData(w:int, h:int, length:int):void + public function startScreenData(w:int, h:int, length:int, name:String, script:String):void + { + testName=name; + scriptName=script; + pbhb.visible = true; + pb.maximum = length; + pb.setProgress(0, length); + sba = new ByteArray(); + sbd = new BitmapData(w, h); + } + public function addScreenData(s:String):void + { + toByteArray(sba, s); + pb.setProgress(sba.position, pb.maximum); + } + + private var bbd:BitmapData; + private var bba:ByteArray; + public function startBaseData(w:int, h:int, length:int):void + { + pb.visible = true; + pb.maximum = length; + pb.setProgress(0, length); + bba = new ByteArray(); + bbd = new BitmapData(w, h); + } + public function addBaseData(s:String):void + { + toByteArray(bba, s); + pb.setProgress(bba.position, pb.maximum); + } + + public function compareBitmaps():void + { + + init(); + pbhb.visible = false; + var bm1:Bitmap = new Bitmap(); + var bm2:Bitmap = new Bitmap(); + sba.position = 0; + bba.position = 0; + sbd.setPixels(sbd.rect, sba); + bbd.setPixels(bbd.rect, bba); + bm1.bitmapData = sbd; + bm2.bitmapData = bbd; + image1.load(bm1); + image2.load(bm2); + image1.scaleX = 1; + image1.scaleY = 1; + image2.scaleX = 1; + image2.scaleY = 1; + canvas1.width = sbd.width; + canvas1.height = sbd.height; + canvas2.width = bbd.width; + canvas2.height = bbd.height; + + doCompare(true); + } + + private var byteTable:Object = new Object(); + + private function toByteArray(ba:ByteArray, s:String):void + { + var arr:Array = s.split(","); + + var n:int = arr.length; + for (var i:int = 0; i < n; i++) + { + var b:String = arr[i]; + var byte:int = byteTable[b]; + ba.writeByte(byte); + } + } + + public function doCompare(cont:Boolean = false):void + { + + var bm1:BitmapData = new BitmapData(image1.content.width, image1.content.height); + bm1.draw(image1.content, new Matrix()); + + var bm2:BitmapData = new BitmapData(image2.content.width, image2.content.height); + bm2.draw(image2.content, new Matrix()); + + if (results) { + canvas3.removeChild(results); + } + + if (contButton) + { + removeChild(contButton); + + } + + var cmp:Object = bm1.compare(bm2); + var label:Label; + + if (cmp == 0) + { + results = label = new Label(); + label.text = "Same"; + label.validateNow(); + canvas3.addChild(results); + canvas3.width = results.width; + canvas3.height = results.height; + if (cont) + { + contButton = new Button(); + contButton.label = "Continue"; + addChild(contButton); + contButton.addEventListener("click", continueHandler); + } + } + else if (cmp == -3) + { + results = label = new Label(); + label.text = "Widths are Different: " + image1.content.width + " vs " + image2.content.width; + label.validateNow(); + canvas3.addChild(results); + canvas3.width = results.width; + canvas3.height = results.height; + if (cont) + { + contButton = new Button(); + contButton.label = "Continue"; + addChild(contButton); + contButton.addEventListener("click", continueHandler); + } + } + else if (cmp == -4) + { + results = label = new Label(); + label.text = "Heights are Different: " + image1.content.height + " vs " + image2.content.height; + label.validateNow(); + canvas3.addChild(results); + canvas3.width = results.width; + canvas3.height = results.height; + if (cont) + { + contButton = new Button(); + contButton.label = "Continue"; + addChild(contButton); + contButton.addEventListener("click", continueHandler); + } + } + else + { + results = new UIComponent(); + var bm:Bitmap = new Bitmap(); + results.addChild(bm); + bm.bitmapData = BitmapData(cmp); + results.width = image1.content.width; + results.height = image1.content.height; + canvas3.addChild(results); + canvas3.width = results.width; + canvas3.height = results.height; + results.graphics.clear(); + results.graphics.beginFill(bg.selectedColor); + results.graphics.drawRect(0, 0, results.width, results.height); + results.graphics.endFill(); + if (cont) + { + contButton = new Button(); + contButton.label = "Continue"; + addChild(contButton); + contButton.addEventListener("click", continueHandler); + } + } + + } + + private function continueHandler(event:Event):void + { + if (results) + { + results.graphics.clear(); + canvas1.width = 0; + canvas1.height = 0; + canvas2.width = 0; + canvas2.height = 0; + canvas3.width = 0; + canvas3.height = 0; + } + + commandconnection.send("_ImageDifferCommands", "keepGoing"); + } + + private function bgChanged():void + { + if (results) + { + results.graphics.clear(); + results.graphics.beginFill(bg.selectedColor); + results.graphics.drawRect(0, 0, results.width, results.height); + results.graphics.endFill(); + } + } + + private function getPixel(target:UIComponent, x:int, y:int, lbl:Label, bg:UIComponent):void + { + var pt:Point = new Point(x, y); + var screenBits:BitmapData = new BitmapData(target.width, target.height); + screenBits.draw(target, new Matrix(1, 0, 0, 1, 0, 0)); + + var clr:uint = screenBits.getPixel(pt.x, pt.y); + var s:String = clr.toString(16); + while (s.length < 6) + { + s = "0" + s; + } + lbl.text = s.toUpperCase(); + bg.graphics.beginFill(clr); + bg.graphics.drawRect(0, 0, bg.width, bg.height); + bg.graphics.endFill(); + } + + private function pixelTracking():void + { + if (cb.selected) + systemManager.addEventListener("mouseMove", pixelTracker); + else + systemManager.removeEventListener("mouseMove", pixelTracker); + } + + private function pixelTracker(event:MouseEvent):void + { + if (image1.contains(event.target as DisplayObject)) + { + updatePixels(image1, event.localX, event.localY, "1"); + } + else if (image2.contains(event.target as DisplayObject)) + { + updatePixels(image2, event.localX, event.localY, "2"); + } + else if (results && results.contains(event.target as DisplayObject)) + { + updatePixels(results, event.localX, event.localY, "3"); + } + } + + private function updatePixels(target:UIComponent, x:Number, y:Number, ui:String):void + { + var nsx:NumericStepper = this["img" + ui + "x"]; + var nsy:NumericStepper = this["img" + ui + "y"]; + nsx.value = x; + nsy.value = y; + var lbl:Label = this["pixel" + ui]; + var bg:UIComponent = this["bg" + ui]; + getPixel(target, x, y, lbl, bg); + } + + private function sizeCanvas1():void + { + image1.scaleX = 1; + image1.scaleY = 1; + canvas1.width = image1.content.width; + canvas1.height = image1.content.height; + } + + private function sizeCanvas2():void + { + image2.scaleX = 1; + image2.scaleY = 1; + canvas2.width = image2.content.width; + canvas2.height = image2.content.height; + } + + private function zoomit():void + { + image1.scaleY = image1.scaleX = zoom.value; + image1.validateNow(); + image2.scaleY = image2.scaleX = zoom.value; + image2.validateNow(); + results.scaleY = results.scaleX = zoom.value; + results.validateNow(); + if (canvas1.width < 100) + { + canvas1.width = Math.min(image1.width, 100); + canvas1.height= Math.min(image1.height, 100); + canvas2.width = Math.min(image2.width, 100); + canvas2.height= Math.min(image2.height, 100); + canvas3.width = Math.min(results.width, 100); + canvas3.height= Math.min(results.height, 100); + } + } + ]]> + </mx:Script> + + <mx:HBox id="pbhb" visible="false"> + <mx:Label text="receiving data..." /> + <mx:ProgressBar id="pb" mode="manual" width="400" /> + </mx:HBox> + <mx:HBox id="testCaseLabel" visible="true"> + <mx:Label text="{scriptName} {testName}" /> + </mx:HBox> + <mx:HBox> + <mx:VBox> + <mx:HBox> + <mx:Label text="image 1" /> + <mx:TextInput id="image1Name" /> + <mx:Button label="load" click="image1.source=image1Name.text" /> + </mx:HBox> + </mx:VBox> + <mx:Spacer width="100" /> + <mx:VBox> + <mx:HBox> + <mx:Label text="image 2" /> + <mx:TextInput id="image2Name" /> + <mx:Button label="load" click="image2.source=image2Name.text" /> + </mx:HBox> + </mx:VBox> + </mx:HBox> + <mx:Button label="compare" click="compareBitmaps()" /> + <mx:HBox> + <mx:VBox> + <mx:Canvas id="canvas1" minHeight="0" minWidth="0" > + <mx:Image id="image1" complete="sizeCanvas1()" /> + </mx:Canvas> + <mx:HBox> + <mx:Label text="x" /> + <mx:NumericStepper id="img1x" width="60" maximum="4000" /> + <mx:Label text="y" /> + <mx:NumericStepper id="img1y" width="60" maximum="4000" /> + <mx:Button label="get pixel" click="getPixel(image1, img1x.value, img1y.value, pixel1, bg1)" /> + <mx:Label id="pixel1" /> + <mx:UIComponent id="bg1" width="16" height="16" /> + </mx:HBox> + </mx:VBox> + <mx:Spacer width="50" /> + <mx:VBox> + <mx:Canvas id="canvas2" minHeight="0" minWidth="0" > + <mx:Image id="image2" complete="sizeCanvas2()" /> + </mx:Canvas> + <mx:HBox> + <mx:Label text="x" /> + <mx:NumericStepper id="img2x" width="60" maximum="4000" /> + <mx:Label text="y" /> + <mx:NumericStepper id="img2y" width="60" maximum="4000" /> + <mx:Button label="get pixel" click="getPixel(image2, img2x.value, img2y.value, pixel2, bg2)" /> + <mx:Label id="pixel2" /> + <mx:UIComponent id="bg2" width="16" height="16" /> + </mx:HBox> + </mx:VBox> + </mx:HBox> + <mx:HBox> + <mx:CheckBox id="cb" label="Pixel Reading" click="pixelTracking()" /> + <mx:Label text="Zoom" /> + <mx:NumericStepper id="zoom" minimum="1" change="zoomit()" /> + <mx:Label text="background" /> + <mx:ColorPicker id="bg" change="bgChanged();" /> + </mx:HBox> + <mx:Canvas id="canvas3" minHeight="0" minWidth="0" /> + <mx:HBox> + <mx:Label text="x" /> + <mx:NumericStepper id="img3x" width="60" maximum="4000" /> + <mx:Label text="y" /> + <mx:NumericStepper id="img3y" width="60" maximum="4000" /> + <mx:Button label="get pixel" click="getPixel(results, img3x.value, img3y.value, pixel3, bg3)" /> + <mx:Label id="pixel3" /> + <mx:UIComponent id="bg3" width="16" height="16" /> + </mx:HBox> + +</mx:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/main.mxml ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/main.mxml b/mustella/src/main/flex/main.mxml new file mode 100644 index 0000000..6043307 --- /dev/null +++ b/mustella/src/main/flex/main.mxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" > + + <mx:Script> + <![CDATA[ + ]]> + </mx:Script> + + <mx:ComboBox id="cb" /> + + <mx:DateField id="df" /> + + <mx:Button id="btn" /> + + <mx:CreditCardValidator id="ccv" /> + +</mx:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/myBitmap.png ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/myBitmap.png b/mustella/src/main/flex/myBitmap.png new file mode 100644 index 0000000..1932ef6 Binary files /dev/null and b/mustella/src/main/flex/myBitmap.png differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/myTest4.png ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/myTest4.png b/mustella/src/main/flex/myTest4.png new file mode 100644 index 0000000..3e377a5 Binary files /dev/null and b/mustella/src/main/flex/myTest4.png differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/skins/pauseButtonSkin.mxml ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/skins/pauseButtonSkin.mxml b/mustella/src/main/flex/skins/pauseButtonSkin.mxml new file mode 100644 index 0000000..44c21ab --- /dev/null +++ b/mustella/src/main/flex/skins/pauseButtonSkin.mxml @@ -0,0 +1,176 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<!--- The default skin class for the Spark Button component. + + @langversion 3.0 + @playerversion Flash 10 + @playerversion AIR 1.5 + @productversion Flex 4 +--> +<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" + minWidth="21" minHeight="21" + alpha.disabled="0.5" blendMode.disabled="layer"> + + <!-- host component --> + <fx:Metadata> + <![CDATA[ + /** + * @copy spark.skins.spark.ApplicationSkin#hostComponent + */ + [HostComponent("spark.components.Button")] + ]]> + </fx:Metadata> + + <fx:Script> + <![CDATA[ + /* Define the skin elements that should not be colorized. + For button, the graphics are colorized but the label is not. */ + static private const exclusions:Array = ["labelDisplay"]; + + /** + * @copy spark.skins.SparkSkin#colorizeExclusions + */ + override public function get colorizeExclusions():Array {return exclusions;} + + [Embed(source="pauseIcon.png")] + [Bindable] + public var PauseIcon:Class; + ]]> + </fx:Script> + + <!-- states --> + <s:states> + <s:State name="up" /> + <s:State name="over" /> + <s:State name="down" /> + <s:State name="disabled" /> + </s:states> + + <!-- layer 1: shadow --> + <s:Rect left="-1" right="-1" top="-1" bottom="-1" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0x000000" + color.down="0xFFFFFF" + alpha="0.01" + alpha.down="0" /> + <s:GradientEntry color="0x000000" + color.down="0xFFFFFF" + alpha="0.07" + alpha.down="0.5" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 2: fill --> + <s:Rect left="1" right="1" top="1" bottom="1" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0xFFFFFF" + color.over="0xBBBDBD" + color.down="0xAAAAAA" + alpha="0.85" /> + <s:GradientEntry color="0xD8D8D8" + color.over="0x9FA0A1" + color.down="0x929496" + alpha="0.85" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 3: fill lowlight --> + <s:Rect left="1" right="1" bottom="1" height="9" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0x000000" alpha="0.0099" /> + <s:GradientEntry color="0x000000" alpha="0.0627" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 4: fill highlight --> + <s:Rect left="1" right="1" top="1" height="9" radiusX="2" radiusY="2"> + <s:fill> + <s:SolidColor color="0xFFFFFF" + alpha="0.33" + alpha.over="0.22" + alpha.down="0.12" /> + </s:fill> + </s:Rect> + + <!-- layer 5: highlight stroke (all states except down) --> + <s:Rect left="1" right="1" top="1" bottom="1" radiusX="2" radiusY="2" excludeFrom="down"> + <s:stroke> + <s:LinearGradientStroke rotation="90" weight="1"> + <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" /> + <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" /> + </s:LinearGradientStroke> + </s:stroke> + </s:Rect> + + <!-- layer 6: highlight stroke (down state only) --> + <s:Rect left="1" top="1" bottom="1" width="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.07" /> + </s:fill> + </s:Rect> + <s:Rect right="1" top="1" bottom="1" width="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.07" /> + </s:fill> + </s:Rect> + <s:Rect left="2" top="1" right="2" height="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.25" /> + </s:fill> + </s:Rect> + <s:Rect left="1" top="2" right="1" height="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.09" /> + </s:fill> + </s:Rect> + + <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 --> + <s:Rect left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="2" radiusY="2"> + <s:stroke> + <s:LinearGradientStroke rotation="90" weight="1"> + <s:GradientEntry color="0x000000" + alpha="0.5625" + alpha.down="0.6375" /> + <s:GradientEntry color="0x000000" + alpha="0.75" + alpha.down="0.85" /> + </s:LinearGradientStroke> + </s:stroke> + </s:Rect> + + <!-- layer 8: text --> + <!--- + @copy spark.components.supportClasses.ButtonBase#labelDisplay + --> + <s:Group> + <s:BitmapImage source="{PauseIcon}" x="3" y="1" /> + <s:Label x="28" y="5" id="labelDisplay" + textAlign="center"> + </s:Label> + </s:Group> +</s:SparkSkin> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/skins/pauseIcon.png ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/skins/pauseIcon.png b/mustella/src/main/flex/skins/pauseIcon.png new file mode 100644 index 0000000..a2bffb9 Binary files /dev/null and b/mustella/src/main/flex/skins/pauseIcon.png differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/skins/playButtonSkin.mxml ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/skins/playButtonSkin.mxml b/mustella/src/main/flex/skins/playButtonSkin.mxml new file mode 100644 index 0000000..da44a3c --- /dev/null +++ b/mustella/src/main/flex/skins/playButtonSkin.mxml @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<!--- The default skin class for the Spark Button component. + + @langversion 3.0 + @playerversion Flash 10 + @playerversion AIR 1.5 + @productversion Flex 4 +--> +<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" + minWidth="21" minHeight="21" + alpha.disabled="0.5" blendMode.disabled="layer"> + + <!-- host component --> + <fx:Metadata> + <![CDATA[ + /** + * @copy spark.skins.spark.ApplicationSkin#hostComponent + */ + [HostComponent("spark.components.Button")] + ]]> + </fx:Metadata> + + <fx:Script> + <![CDATA[ + /* Define the skin elements that should not be colorized. + For button, the graphics are colorized but the label is not. */ + static private const exclusions:Array = ["labelDisplay"]; + + /** + * @copy spark.skins.SparkSkin#colorizeExclusions + */ + override public function get colorizeExclusions():Array {return exclusions;} + + [Embed(source="playIcon.png")] + [Bindable] + public var PlayIcon:Class; + ]]> + </fx:Script> + + <!-- states --> + <s:states> + <s:State name="up" /> + <s:State name="over" /> + <s:State name="down" /> + <s:State name="disabled" /> + </s:states> + + <!-- layer 1: shadow --> + <s:Rect left="-1" right="-1" top="-1" bottom="-1" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0x000000" + color.down="0xFFFFFF" + alpha="0.01" + alpha.down="0" /> + <s:GradientEntry color="0x000000" + color.down="0xFFFFFF" + alpha="0.07" + alpha.down="0.5" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 2: fill --> + <s:Rect left="1" right="1" top="1" bottom="1" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0xFFFFFF" + color.over="0xBBBDBD" + color.down="0xAAAAAA" + alpha="0.85" /> + <s:GradientEntry color="0xD8D8D8" + color.over="0x9FA0A1" + color.down="0x929496" + alpha="0.85" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 3: fill lowlight --> + <s:Rect left="1" right="1" bottom="1" height="9" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0x000000" alpha="0.0099" /> + <s:GradientEntry color="0x000000" alpha="0.0627" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 4: fill highlight --> + <s:Rect left="1" right="1" top="1" height="9" radiusX="2" radiusY="2"> + <s:fill> + <s:SolidColor color="0xFFFFFF" + alpha="0.33" + alpha.over="0.22" + alpha.down="0.12" /> + </s:fill> + </s:Rect> + + <!-- layer 5: highlight stroke (all states except down) --> + <s:Rect left="1" right="1" top="1" bottom="1" radiusX="2" radiusY="2" excludeFrom="down"> + <s:stroke> + <s:LinearGradientStroke rotation="90" weight="1"> + <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" /> + <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" /> + </s:LinearGradientStroke> + </s:stroke> + </s:Rect> + + <!-- layer 6: highlight stroke (down state only) --> + <s:Rect left="1" top="1" bottom="1" width="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.07" /> + </s:fill> + </s:Rect> + <s:Rect right="1" top="1" bottom="1" width="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.07" /> + </s:fill> + </s:Rect> + <s:Rect left="2" top="1" right="2" height="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.25" /> + </s:fill> + </s:Rect> + <s:Rect left="1" top="2" right="1" height="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.09" /> + </s:fill> + </s:Rect> + + <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 --> + <s:Rect left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="2" radiusY="2"> + <s:stroke> + <s:LinearGradientStroke rotation="90" weight="1"> + <s:GradientEntry color="0x000000" + alpha="0.5625" + alpha.down="0.6375" /> + <s:GradientEntry color="0x000000" + alpha="0.75" + alpha.down="0.85" /> + </s:LinearGradientStroke> + </s:stroke> + </s:Rect> + + <!-- layer 8: text --> + <!--- + @copy spark.components.supportClasses.ButtonBase#labelDisplay + --> + <s:Group> + <s:BitmapImage source="{PlayIcon}" x="10" y="2" /> + <s:Label x="35" y="6" id="labelDisplay" + textAlign="center"> + </s:Label> + </s:Group> +</s:SparkSkin> + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/skins/playIcon.png ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/skins/playIcon.png b/mustella/src/main/flex/skins/playIcon.png new file mode 100644 index 0000000..af56a43 Binary files /dev/null and b/mustella/src/main/flex/skins/playIcon.png differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/skins/stepButtonSkin.mxml ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/skins/stepButtonSkin.mxml b/mustella/src/main/flex/skins/stepButtonSkin.mxml new file mode 100644 index 0000000..13e6151 --- /dev/null +++ b/mustella/src/main/flex/skins/stepButtonSkin.mxml @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<!--- The default skin class for the Spark Button component. + + @langversion 3.0 + @playerversion Flash 10 + @playerversion AIR 1.5 + @productversion Flex 4 +--> +<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" + minWidth="21" minHeight="21" + alpha.disabled="0.5" blendMode.disabled="layer"> + + <!-- host component --> + <fx:Metadata> + <![CDATA[ + /** + * @copy spark.skins.spark.ApplicationSkin#hostComponent + */ + [HostComponent("spark.components.Button")] + ]]> + </fx:Metadata> + + <fx:Script> + <![CDATA[ + /* Define the skin elements that should not be colorized. + For button, the graphics are colorized but the label is not. */ + static private const exclusions:Array = ["labelDisplay"]; + + /** + * @copy spark.skins.SparkSkin#colorizeExclusions + */ + override public function get colorizeExclusions():Array {return exclusions;} + + [Embed(source="stepIcon.png")] + [Bindable] + public var StepIcon:Class; + ]]> + </fx:Script> + + <!-- states --> + <s:states> + <s:State name="up" /> + <s:State name="over" /> + <s:State name="down" /> + <s:State name="disabled" /> + </s:states> + + <!-- layer 1: shadow --> + <s:Rect left="-1" right="-1" top="-1" bottom="-1" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0x000000" + color.down="0xFFFFFF" + alpha="0.01" + alpha.down="0" /> + <s:GradientEntry color="0x000000" + color.down="0xFFFFFF" + alpha="0.07" + alpha.down="0.5" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 2: fill --> + <s:Rect left="1" right="1" top="1" bottom="1" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0xFFFFFF" + color.over="0xBBBDBD" + color.down="0xAAAAAA" + alpha="0.85" /> + <s:GradientEntry color="0xD8D8D8" + color.over="0x9FA0A1" + color.down="0x929496" + alpha="0.85" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 3: fill lowlight --> + <s:Rect left="1" right="1" bottom="1" height="9" radiusX="2" radiusY="2"> + <s:fill> + <s:LinearGradient rotation="90"> + <s:GradientEntry color="0x000000" alpha="0.0099" /> + <s:GradientEntry color="0x000000" alpha="0.0627" /> + </s:LinearGradient> + </s:fill> + </s:Rect> + + <!-- layer 4: fill highlight --> + <s:Rect left="1" right="1" top="1" height="9" radiusX="2" radiusY="2"> + <s:fill> + <s:SolidColor color="0xFFFFFF" + alpha="0.33" + alpha.over="0.22" + alpha.down="0.12" /> + </s:fill> + </s:Rect> + + <!-- layer 5: highlight stroke (all states except down) --> + <s:Rect left="1" right="1" top="1" bottom="1" radiusX="2" radiusY="2" excludeFrom="down"> + <s:stroke> + <s:LinearGradientStroke rotation="90" weight="1"> + <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" /> + <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" /> + </s:LinearGradientStroke> + </s:stroke> + </s:Rect> + + <!-- layer 6: highlight stroke (down state only) --> + <s:Rect left="1" top="1" bottom="1" width="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.07" /> + </s:fill> + </s:Rect> + <s:Rect right="1" top="1" bottom="1" width="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.07" /> + </s:fill> + </s:Rect> + <s:Rect left="2" top="1" right="2" height="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.25" /> + </s:fill> + </s:Rect> + <s:Rect left="1" top="2" right="1" height="1" includeIn="down"> + <s:fill> + <s:SolidColor color="0x000000" alpha="0.09" /> + </s:fill> + </s:Rect> + + <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 --> + <s:Rect left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="2" radiusY="2"> + <s:stroke> + <s:LinearGradientStroke rotation="90" weight="1"> + <s:GradientEntry color="0x000000" + alpha="0.5625" + alpha.down="0.6375" /> + <s:GradientEntry color="0x000000" + alpha="0.75" + alpha.down="0.85" /> + </s:LinearGradientStroke> + </s:stroke> + </s:Rect> + + <!-- layer 8: text --> + <!--- + @copy spark.components.supportClasses.ButtonBase#labelDisplay + --> + <s:Group> + <s:BitmapImage source="{StepIcon}" x="10" y="2" /> + <s:Label x="35" y="6" id="labelDisplay" + textAlign="center"> + </s:Label> + </s:Group> +</s:SparkSkin> + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27eb06f5/mustella/src/main/flex/skins/stepIcon.png ---------------------------------------------------------------------- diff --git a/mustella/src/main/flex/skins/stepIcon.png b/mustella/src/main/flex/skins/stepIcon.png new file mode 100644 index 0000000..ad01024 Binary files /dev/null and b/mustella/src/main/flex/skins/stepIcon.png differ