Flex4 Sprite

by aaharu
♥0 | Line 25 | Modified 2010-07-03 19:18:35 | MIT License
play

ActionScript3 source code

/**
 * Copyright aaharu ( http://wonderfl.net/user/aaharu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6jFw
 */

<?xml version="1.0" encoding="utf-8"?>
<!--
Flex4だとSpriteVisualElementってのにaddChildすればいいっぽい。
なにもしないと親のBorderContainer突き抜ける。
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
               creationComplete="application1_creationCompleteHandler(event)">
    <s:BorderContainer x="100" y="100" width="100" height="100">
        <s:SpriteVisualElement id="sprite" width="100" height="100"/>
    </s:BorderContainer>
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            
            protected function application1_creationCompleteHandler(event:FlexEvent):void {
                var sp:Sprite = new Sprite();
                sp.graphics.beginFill(0xFF0000);
                sp.graphics.drawCircle(0, 0, 200);
                sp.graphics.endFill();
                sprite.addChild(sp);
            }
        ]]>
    </fx:Script>
</s:Application>

Forked