Laan's steps..

Feed Rss

javascript for dragging

11.06.2008, flash, js, by .

Sometimes, we need to run the swf in page. At that time we can view the swf debug information. So I got a idea. When the swf is running in page, use the javascript to create a print panel. And then, the swf call javascript methods to show debug information.

The easiest way to do that is creating a class just for that. When  I need to show,  I can create a instance of that class. But firstly, I should to know how to create a panel, print text in that panel, and drag the panel.

About dragging, I had searched a page, witch done that well.

But, the code it shows can’t work. Once you want to drag a object, you should set the position property of that object to “absolute”, such as:<div id=”drag” style=”position:absolute”>drag me <div>

function createDrag(dv){
if ( != “absolute”) { = “absolute”;

var d = document;
e = e || window.event;

var x= e.layerX || e.offsetX;
var y= e.layerY || e.offsetY;

}else if(window.captureEvents){
window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);

dv.onmousemove = function(e){
e= e || window.event;
if(!e.pageX) e.pageX=e.clientX;
if(!e.pageY) e.pageY=e.clientY; = e.pageX – x; = e.pageY – y;

dv.onmouseup = function(){
}else if(window.captureEvents){


javascript for dragging 有 4 条回应

  1. Спасибо за текст! Очень понравилось

  2. RonaldLI :

    Спасибо за текст! Очень понравилось

    Ха ха

    谢谢你的文字!非常高兴 ——来自google翻译,俄语

  3. 2008-11-11 在 10:51 Terrence

    hello. nice to find ur site.
    You might want to take a look at Flash Tracer plugin in Firefox.
    It can debug flash nicely.

  4. thanks



电子邮件地址不会被公开。 必填项已用 * 标注


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>