flex 拖拽,指定拖拽代理,由一个容器拖放到另一个里
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
<mx:Script>
<![CDATA[
import mx.core.BitmapAsset;
import mx.core.DragSource;
import mx.events.DragEvent;
import mx.managers.DragManager;
private var xoffset:Number;
private var yoffset:Number;
private static const FORMAT:String = "box" ;
private function mouseDownHandler(evt:MouseEvent ):void {
xoffset = evt.localX;
yoffset = evt.localY;
var initiator:Box = evt.currentTarget as Box;
var proxyBox:BitmapAsset = new BitmapAsset();
proxyBox.bitmapData = new BitmapData(initiator.width,initiator.height );
proxyBox.bitmapData.draw( initiator );
var dragSource:DragSource = new DragSource();
dragSource.addData( initiator, FORMAT );
DragManager.doDrag( initiator, dragSource, evt,proxyBox, 0, 0, 0.5 );
}
private function dragEnterHandler( evt:DragEvent ):void {
if ( evt.dragSource.hasFormat( FORMAT ) ) {
DragManager.acceptDragDrop(Canvas(evt.currentTarget));
}
}
private function dropHandler( evt:DragEvent ):void {
trace(evt.target);
var box:Box = Box( evt.dragInitiator );
box.x = evt.localX - xoffset;
box.y = evt.localY - yoffset;
this.canvas0.addChild(box);
}
]]>
</mx:Script>
<mx:Canvas id="canvas" backgroundColor="0xEEEEEE" width="300" height="300"
dragEnter="dragEnterHandler(event);" >
<mx:Box id="dragItem" width="52" height="31" backgroundColor="0x00FFCC" mouseDown="mouseDownHandler(event);" x="49" y="45"/>
</mx:Canvas>
<mx:Canvas id="canvas0" backgroundColor="0xEEEEEE" width="300" height="300"
dragEnter="dragEnterHandler(event);" dragDrop="dropHandler(event);">
</mx:Canvas>
</mx:Application>
相关文档:
这个类提供的功能有:
从浏览器中获取完整的URL
主机名
当前所使用的协议
端口
主域名后面的路径
参数值
原文地址:http://www.flexpasta.com/index.php/2008/03/15/getting-url-parameters-host-name-port-in-flex-actionscript/
package com.flexpasta.utils
{
import flash.external.ExternalInterface;
im ......
首先建立插件文件存放目录:
D:\eclipse_plugins\flex3\eclipse\features
D:\eclipse_plugins\flex3\eclipse\plugins
以上路径根据本机实际情况确定
然后把Flex Builder3 中的文件拷贝到对应目录下:
D:\IDE\Flex Builder 3\features\com.adobe * -> D:\eclipse_plugins\flex3\eclipse\features
D:\IDE\Flex ......
flex中背景图片平铺
我们需要一个 degrafa 的组件
已经上传好了.
然后把下载的swc放到项目的libs中
在页面css种这样写就可以了
Application {
background-image: Embed("assets/images/the_image_goes_here.png");
background-r ......
Flex Builder 3.0 For Eclipse 3.3 安装方法
Flex Builder 3.0 For Eclipse 3.3 安装方法
这两天准备学习Flex,于是下载了Flex Builder 3.0 For Eclipse plugin准备安装.
但是安装后启动Eclipse,找了半天也没找到Flex.而且Flex Builder会把JRE也安装.觉得这样很不爽.
所以我想到能不能来个Flex Builder绿色安装方 ......