topical media & game development
sample-flex-shape-logo.mx
sample-flex-shape-logo.mx
[swf]
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="add()"
initialize="init()"
>
documentation(s)
script / auto start
<mx:Script>
<![CDATA[
import mx.core.UIComponent; // only needed if you use the second method
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public var circle:Sprite;
public var xpos:Number = 50;
public var ypos:Number = 50;
public var fade:Number = 0.05;
init(s)
public function init():void{
circle = new Sprite();
circle.graphics.beginFill(0x990000);
circle.graphics.drawCircle(xpos, ypos, 20);
circle.graphics.endFill();
this.rawChildren.addChild(circle); // The quick and dirty method
/* OR YOU CAN DO THIS
var uic:UIComponent = new UIComponent();
uic.addChild(circle);
addChild(uic);
*/
}
animate
private function add():void {
circle.addEventListener(Event.ENTER_FRAME, fadeCircle);
}
effect(s) / fade
private function fadeCircle(event:Event):void{
circle.alpha -= fade;
if (circle.alpha <= 0){
fade = -fade;
circle.alpha = 0.05;
}
else if (circle.alpha > 1){
fade = -fade;
circle.alpha = 0.95;
}
}
]]>
</mx:Script>
effect(s)
<mx:Resize id="resizeBig" widthFrom="80" widthTo="120"/>
<mx:Resize id="resizeSmall" widthFrom="120" widthTo="80"/>
image(s)
<mx:Image right="10" bottom="10"
width="80"
rollOverEffect="{resizeBig}"
rollOutEffect="{resizeSmall}"
click="navigateToURL( new URLRequest('http://www.cs.vu.nl/~eliens/ma'))"
source="@logo.gif" />
<mx:Label x="50" y="50" text="AE" fontSize="28" />
</mx:Canvas>
(C) Æliens
27/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.