03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

You can extend the methods <strong>and</strong> event h<strong>and</strong>lers of the MovieClip class by creating a subclass.<br />

Parameters<br />

pt:Object - The name or identifier of an object created with the generic Object class. The<br />

object specifies the x <strong>and</strong> y coordinates as properties.<br />

Example<br />

Add the following ActionScript to a FLA or AS file in the same directory as an image called<br />

photo1.jpg:<br />

this.createTextField("coords_txt", this.getNextHighestDepth(), 10, 10, 100,<br />

22);<br />

coords_txt.html = true;<br />

coords_txt.multiline = true;<br />

coords_txt.autoSize = true;<br />

this.createEmptyMovieClip("target_mc", this.getNextHighestDepth());<br />

target_mc._x = 100;<br />

target_mc._y = 100;<br />

target_mc.loadMovie("photo1.jpg");<br />

var mouseListener:Object = new Object();<br />

mouseListener.onMouseMove = function() {<br />

var point:Object = {x:_xmouse, y:_ymouse};<br />

target_mc.globalToLocal(point);<br />

var rowHeaders = " &nbsp; \t_x\t_y";<br />

var row_1 = "_root\t"+_xmouse+"\t"+_ymouse;<br />

var row_2 = "target_mc\t"+point.x+"\t"+point.y;<br />

coords_txt.htmlText = "";<br />

coords_txt.htmlText += rowHeaders;<br />

coords_txt.htmlText += row_1;<br />

coords_txt.htmlText += row_2;<br />

coords_txt.htmlText += "";<br />

};<br />

Mouse.addListener(mouseListener);<br />

See also<br />

getBounds (MovieClip.getBounds method), localToGlobal<br />

(MovieClip.localToGlobal method), Object<br />

gotoAndPlay (MovieClip.gotoAndPlay method)<br />

public gotoAndPlay(frame:Object) : Void<br />

Starts playing the SWF file at the specified frame. To specify a scene as well as a frame, use<br />

gotoAndPlay().<br />

434 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!