topical media & game development
lib-flex-ximpel-editor-net-ximpel-classes-OverlayCel.ax
lib-flex-ximpel-editor-net-ximpel-classes-OverlayCel.ax
(swf
)
[ flash
]
flex
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Javier Quevedo Fernández 05-2009.
*/
package net.ximpel.classes
{
public class @ax-lib-flex-ximpel-editor-net-ximpel-classes-OverlayCel implements IHasXMLRepresentation
{
[Bindable]
public var x:Number;
[Bindable]
public var y:Number;
[Bindable]
public var width:int;
[Bindable]
public var height:int;
[Bindable]
public var alpha:Number;
[Bindable]
public var color:String;
[Bindable]
public var image:String;
[Bindable]
public var leadsTo:Subject;
[Bindable]
public var hoverAlpha:Number;
[Bindable]
public var hoverColor:String;
[Bindable]
public var hoverImage:String;
[Bindable]
public var label:String;
public function @ax-lib-flex-ximpel-editor-net-ximpel-classes-OverlayCel(newX:int = 0, newY:int = 0, newWidth:int = 128, newHeight:int = 128,
newAlpha:Number = 0.5, newColor:String = null, newImage:String = null,
newHoverAlpha:Number = 1.0, newHoverColor:String = null, newHoverImage:String = null,
newLabel:String = "Cell label")
{
x = newX;
y = newY;
width = newWidth;
height = newHeight;
alpha = newAlpha;
color = newColor;
image = newImage;
leadsTo = null;
hoverAlpha = newHoverAlpha;
hoverColor = newHoverColor;
hoverImage = newImage;
label = newLabel;
}
public function toXML():XML
{
var attributes:String = "x=\"" + String(x) + "\"" +
" y=\"" + String(y) + "\"" +
" width=\"" + String(width) + "\"" +
" height=\"" + String(height) + "\"" +
" label=\"" + String(label) + "\"";
if(alpha > -1){
attributes = attributes + " alpha=\"" + String(alpha) + "\"";
}
if (color != null) {
attributes = attributes + " color=\"" + "#"+uint(color).toString(16) + "\"";
}
if (leadsTo && leadsTo.id != "") {
attributes = attributes + " leadsto=\"" + leadsTo.id + "\"";
}
if (image != null) {
attributes = attributes + " image=\"" + image + "\"";
}
if(hoverAlpha > -1){
attributes = attributes + " hover_alpha=\"" + String(hoverAlpha) + "\"";
}
if (hoverColor != null) {
attributes = attributes + " hover_color=\"" + "#"+uint(hoverColor).toString(16) + "\"";
}
if (hoverImage != null) {
attributes = attributes + " hover_image=\"" + hoverImage + "\"";
}
var overlayCel:XML =
<overlaycel {attributes}/>;
return overlayCel;
}
}
}
(C) Æliens
19/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.