Flex 画线的方法 2
来源:互联网 发布:手机淘宝阿里巴巴 编辑:程序博客网 时间:2024/05/01 18:28
public var lines1 :flash.display.Sprite = new Sprite (); // lines1.graphics.lineStyle(2,0x0099ff,1);//设置颜色 粗细 lines1.graphics.moveTo(uFrom.x+uFrom.width/2,uFrom.y+uFrom.height/2); //从某个坐标开始 lines1.graphics.lineTo(uTo.x+uTo.width/2,uTo.y+uTo.height/2); //画到某个坐标 //因为addChild方法 不能识别 非继承mc.core.UIComponent的控件 所以先声明一个组件 把控件放进去然后在放进界面中 var comp: UIComponent = new UIComponent(); comp.addChild(lines); addChild(comp); 再flex 3 IDE Flex Builder 3 beta 3下编译通过
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" borderColor="#FFFFFF" >
<mx:Script>
<![CDATA[
import mx.effects.Move;
import mx.controls.*;
import mx.core.*;
import mx.effects.*;
public var lines :Sprite = new Sprite ();
public var lines1 :flash.display.Sprite = new Sprite ();
public function TestPaint():void
{
//Alert.show("Hello World!");
lines.graphics.lineStyle(2,0x0099ff,1);
DrawLine(lines,lbl,btn1);
DrawLine(lines,lbl,btn2);
DrawLine(lines,lbl,btn3);
var comp: UIComponent = new UIComponent();
comp.addChild(lines);
addChild(comp);
}
public function DrawLine(lines:Sprite,uFrom:UIComponent,uTo:UIComponent):void
{
lines.graphics.moveTo(uFrom.x+uFrom.width/2,uFrom.y+uFrom.height/2);
lines.graphics.lineTo(uTo.x+uTo.width/2,uTo.y+uTo.height/2);
}
public function btn1_mouseOver(event:Event):void
{
lines1.graphics.lineStyle(2,0xd43dd6,1);
DrawLine(lines1,btn1,btn2);
DrawLine(lines1,btn1,lbl);
var comp: UIComponent = new UIComponent();
comp.addChild(lines1);
addChild(comp);
}
public function btn1_mouseOut(event:Event):void
{
lines1.graphics.clear();
DrawLine(lines,lbl,btn1);
}
public function Testmove():void
{
var move:Move = new Move();
if(btn2.x!=lbl.x)
{
move.target=btn2;
move.end();
move.xTo=lbl.x;
move.yTo=lbl.y;
move.play();
}
else
{
move.target=btn2;
move.end();
move.xTo=340;
move.yTo=104;
move.play();
}
}
]]>
</mx:Script>
<mx:Button x="176" y="34" label="btn1" id="btn1" mouseOver="btn1_mouseOver(event)" mouseOut="btn1_mouseOut(event)"/>
<mx:Button x="340" y="104" label="btn4" id="btn2"/>
<mx:Button x="53" y="167" label="btn3" id="btn3"/>
<mx:Button x="131" y="373" label="Paint" click="TestPaint()"/>
<mx:Label x="176" y="169" text="LblMiddle" width="71" height="20" id="lbl"/>
<mx:Button x="303" y="324" label="Move" click="Testmove()"/>
</mx:Application>
- Flex 画线的方法 2
- Flex 画线的方法
- Flex 画线的方法
- 代码画线的方法
- 画线的基本方法
- IOS的画线方法 CGContext
- 使用UIImageView的画线方法
- flex 实现鼠标画线
- Flex示例:实现画线
- Flex示例:实现画线
- 整个屏幕上画线的方法
- \t\tVC中几种画线的方法
- siverlight的几种画线方法
- 用CGContextRef一些画图画线的方法
- 用CGContextRef一些画图画线的方法
- 两点画线比较简单的方法
- arcgis api for flex 地图选点画线 可拖动变色【写给已逝去的arcgis flex】
- FLEX画线+预览+撤销重做
- nandflash驱动分析以及与norflash的比较//来源不详
- 九月的薄荷香
- Sketchup 技巧小结
- powerDesinger15
- 嵌入式系统中LCD驱动的实现原理//来源不详
- Flex 画线的方法 2
- 海绵宝宝
- rsync、ssh备份
- 怎么样写简历
- 智能指针
- C/C++输入输出
- UVa 10310 Dog and Gopher(long long)
- Google APP Engine(转http://developer.51cto.com/art/200904/119400.htm)
- 惑