http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f399ec5/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/GraphicShape.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/GraphicShape.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/GraphicShape.as new file mode 100644 index 0000000..8d06985 --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/GraphicShape.as @@ -0,0 +1,76 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.flex.createjs.graphics +{ + COMPILE::AS3 + { + import org.apache.flex.core.graphics.GraphicShape + } + + COMPILE::JS + { + import createjs.Shape; + import createjs.Stage; + + import org.apache.flex.createjs.core.CreateJSBase; + import org.apache.flex.core.WrappedHTMLElement; + } + + import org.apache.flex.core.graphics.IFill; + import org.apache.flex.core.graphics.IStroke; + + /** + * This is the base class for CreateJS graphic shape components such as + * Circle and Rect. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion FlexJS 0.0 + */ + + COMPILE::AS3 + public class GraphicShape extends org.apache.flex.core.graphics.GraphicShape + { + // nothing special for SWF version. + } + + COMPILE::JS + public class GraphicShape extends CreateJSBase + { + /** + * Creates a CreateJS Shape as the element. + * + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion createjs.Shape + */ + override protected function createElement():WrappedHTMLElement + { + var base:createjs.Shape = new createjs.Shape(null); + + element = base as WrappedHTMLElement; + element.flexjs_wrapper = this; + + positioner = element; + + return element; + } + + } +}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f399ec5/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/Rect.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/Rect.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/Rect.as new file mode 100644 index 0000000..eaf0a56 --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/graphics/Rect.as @@ -0,0 +1,93 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.flex.createjs.graphics +{ + COMPILE::AS3 + { + import org.apache.flex.core.graphics.Rect + } + + COMPILE::JS + { + import createjs.Shape; + import createjs.Stage; + import createjs.Graphics; + + import org.apache.flex.createjs.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } + + import org.apache.flex.core.graphics.IFill; + import org.apache.flex.core.graphics.SolidColor; + import org.apache.flex.core.graphics.SolidColorStroke; + + /** + * Creates a rectangle. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion FlexJS 0.0 + */ + + COMPILE::AS3 + public class Rect extends org.apache.flex.core.graphics.Rect + { + // nothing special for SWF version. + } + + COMPILE::JS + public class Rect extends GraphicShape + { + /** + * @private + * @flexjsignorecoercion createjs.Shape + */ + override protected function redrawShape():void + { + if (isNaN(width) || isNaN(height)) return; + + var fillColor:String = null; + var fillAlpha:Number = 1.0; + if (fill != null) { + fillAlpha = (fill as SolidColor).alpha; + fillColor = convertColorToString((fill as SolidColor).color, fillAlpha); + } + var strokeColor:String = null; + var strokeWeight:Number = 0; + var strokeAlpha:Number = 1.0; + if (stroke != null) { + strokeWeight = (stroke as SolidColorStroke).weight; + strokeAlpha = (stroke as SolidColorStroke).alpha; + strokeColor = convertColorToString((stroke as SolidColorStroke).color, strokeAlpha); + } + + var rect:createjs.Shape = element as createjs.Shape; + rect.graphics.setStrokeStyle(strokeWeight); + rect.graphics.beginStroke(strokeColor); + rect.graphics.beginFill(fillColor); + rect.graphics.rect(0, 0, width, height); + + var stage:createjs.Stage = rect.getStage(); + if (stage) + stage.update(); + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f399ec5/frameworks/projects/CreateJS/src/main/resources/compile-asjs-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/resources/compile-asjs-config.xml b/frameworks/projects/CreateJS/src/main/resources/compile-asjs-config.xml index cd48012..3e82454 100644 --- a/frameworks/projects/CreateJS/src/main/resources/compile-asjs-config.xml +++ b/frameworks/projects/CreateJS/src/main/resources/compile-asjs-config.xml @@ -58,6 +58,7 @@ <library-path> <path-element>../../../../../externs/Core.swc</path-element> <path-element>../../../../../externs/HTML.swc</path-element> + <path-element>../../../../../externs/Graphics.swc</path-element> </library-path> <warn-no-constructor>false</warn-no-constructor> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f399ec5/frameworks/projects/CreateJS/src/main/resources/compile-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/resources/compile-config.xml b/frameworks/projects/CreateJS/src/main/resources/compile-config.xml index 46f455d..1ce2f99 100644 --- a/frameworks/projects/CreateJS/src/main/resources/compile-config.xml +++ b/frameworks/projects/CreateJS/src/main/resources/compile-config.xml @@ -25,6 +25,7 @@ <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> <path-element>../../../../../libs/Core.swc</path-element> <path-element>../../../../../libs/HTML.swc</path-element> + <path-element>../../../../../libs/Graphics.swc</path-element> </external-library-path> <mxml> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f399ec5/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml b/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml index 1c5a5ed..5716695 100644 --- a/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml +++ b/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml @@ -22,10 +22,12 @@ <componentPackage> <component id="Application" class="org.apache.flex.createjs.Application"/> - <component id="UIBase" class="org.apache.flex.createjs.core.UIBase"/> - <component id="ViewBase" class="org.apache.flex.createjs.core.ViewBase"/> - <component id="Label" class="org.apache.flex.createjs.Label"/> + <component id="View" class="org.apache.flex.createjs.core.View"/> + <component id="Container" class="org.apache.flex.createjs.Container" /> <component id="TextButton" class="org.apache.flex.createjs.TextButton"/> <component id="CheckBox" class="org.apache.flex.createjs.CheckBox"/> + <component id="Label" class="org.apache.flex.createjs.Label"/> + <component id="Circle" class="org.apache.flex.createjs.graphics.Circle" /> + <component id="Rect" class="org.apache.flex.createjs.graphics.Rect" /> </componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f399ec5/frameworks/projects/CreateJS/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/resources/defaults.css b/frameworks/projects/CreateJS/src/main/resources/defaults.css index 55fa336..db5cfa7 100644 --- a/frameworks/projects/CreateJS/src/main/resources/defaults.css +++ b/frameworks/projects/CreateJS/src/main/resources/defaults.css @@ -19,15 +19,34 @@ @namespace createjs "library://ns.apache.org/flexjs/createjs"; +createjs|TextButton +{ + IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel"); +} + +createjs|Label +{ + IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel"); +} + +createjs|CheckBox +{ + IBeadModel: ClassReference("org.apache.flex.html.beads.models.ToggleButtonModel"); +} + @media -flex-flash { createjs|TextButton { - IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel"); IBeadView: ClassReference("org.apache.flex.html.beads.TextButtonView"); } +createjs|Label +{ + IBeadView: ClassReference("org.apache.flex.html.beads.TextFieldView"); +} + createjs|CheckBox { IBeadView: ClassReference("org.apache.flex.html.beads.CheckBoxView");