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.

Note: The trackAsMenu property is supported for Flash Lite 2.0 only if<br />

System.capabilities.hasMouse is true or System.capabilities.hasStylus is<br />

true.<br />

Example<br />

The following example demonstrates how to track two buttons as a menu. Place two button<br />

instances called one_btn <strong>and</strong> two_btn on the stage. Enter the following ActionScript in the<br />

Timeline:<br />

var one_btn:Button;<br />

var two_btn:Button;<br />

one_btn.trackAsMenu = true;<br />

two_btn.trackAsMenu = true<br />

one_btn.onRelease = function() {<br />

trace("clicked one_btn");<br />

};<br />

two_btn.onRelease = function() {<br />

trace("clicked two_btn");<br />

};<br />

To test the SWF file, click the Stage over one_btn, hold the mouse button down, <strong>and</strong> release<br />

it over two_btn. Then try commenting out the two lines of ActionScript that contain<br />

trackAsMenu <strong>and</strong> test the SWF file again to see the difference in button behavior.<br />

See also<br />

trackAsMenu (MovieClip.trackAsMenu property)<br />

_url (Button._url property)<br />

public _url : String [read-only]<br />

Retrieves the URL of the SWF file that created the button.<br />

Example<br />

Create two button instances on the Stage called one_btn <strong>and</strong> two_btn. Enter the following<br />

ActionScript in Frame 1 of the Timeline:<br />

var one_btn:Button;<br />

var two_btn:Button;<br />

this.createTextField("output_txt", 999, 0, 0, 100, 22);<br />

output_txt.autoSize = true;<br />

one_btn.onRelease = function() {<br />

trace("clicked one_btn");<br />

trace(this._url);<br />

};<br />

two_btn.onRelease = function() {<br />

272 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!