import { DisplayObject } from './DisplayObject'; import { SoundTransform } from '../media/SoundTransform'; import { Timeline, DisplayObject as AwayDisplayObject } from '@awayjs/scene'; import { InteractiveObject } from './InteractiveObject'; /** * The SimpleButton class lets you control all instances of button symbols in a SWF * file. * *

In Flash Professional, you can give a button an instance name in the * Property inspector. SimpleButton instance names are displayed in the Movie * Explorer and in the Insert Target Path dialog box in the Actions * panel. After you create an instance of a button in Flash Professional, you can * use the methods and properties of the SimpleButton class to manipulate buttons * with ActionScript.

In ActionScript 3.0, * you use the new SimpleButton() constructor to create a * SimpleButton instance.

The SimpleButton class inherits from the InteractiveObject class.

* * EXAMPLE: * * The following example uses the SimpleButtonExample class, which in * turn uses the CustomSimpleButton class, and this class then instantiates four * ButtonDisplayState objects. The result is a button that is created in the shape of * a square, whose background color changes based on the mouse state by overriding instance properties of * the SimpleButton class. This is accomplished by performing the following steps: *
    *
  1. In the SimpleButtonExample() * constructor, a new CustomSimpleButton object of type * SimpleButton, called button, * is created, which calls the CustomSimpleButton constructor * method. The button object is the added to the display list. * The button's color and size are * determined in the steps that follow.
  2. * In the CustomSimpleButton class, instance properties are declared that are later used * to control the size and background color of button, * based on the state it is in (orange * in the normal state, dark yellow in the mouse over state, an light blue in the mouse down state). * In all of the button's states, * the size of the square is set to 80 pixels by using the * size property.
  3. *
  4. The constructor function for the CustomSimpleButton class sets the * downState, * overState, * upState, * hitTestState, * and useHandCursor properties with * four instances of the ButtonDisplayState class.
  5. *
  6. In the ButtonDisplayState class, the constructor sets the value of the * square's size and background color and calls the * draw() method.
  7. *
  8. The draw() * method redraws the square with the size and background color set in * the constructor based on the button's state.
  9. *
*/ export declare class SimpleButton extends InteractiveObject { private _soundTransform; /** * Creates a new SimpleButton instance. Any or all of the display objects that represent * the various button states can be set as parameters in the constructor. * @param upState The initial value for the SimpleButton up state. * @param overState The initial value for the SimpleButton over state. * @param downState The initial value for the SimpleButton down state. * @param hitTestState The initial value for the SimpleButton hitTest state. */ constructor(upState?: DisplayObject, overState?: DisplayObject, downState?: DisplayObject, hitTestState?: DisplayObject); addTimelineChildAtDepth(child: AwayDisplayObject, depth: number): AwayDisplayObject; removeTimelineChildAt(value: number): void; /** * queue the mc for executing framescripts * this only queues the frame-index as a number, * the actual framescripts will be retrieved in MovieClip.executeScripts * @param timeline * @param frame_idx * @param scriptPass1 */ queueFrameScripts(timeline: Timeline, frame_idx: number, scriptPass1: boolean): void; removeAllTimelineChilds(): void; constructFrame(timeline: Timeline, start_construct_idx: number, target_keyframe_idx: number, jump_forward: boolean, frame_idx: number, queue_pass2: boolean, queue_script: boolean): void; finalizeChildren(children: AwayDisplayObject[]): void; initAdapter(): void; registerScriptObject(child: any): void; unregisterScriptObject(child: any): void; /** * Specifies a display object that is used as the visual * object for the button "Down" state β€”the state that the button is in when the user * selects the hitTestState object. */ get downState(): DisplayObject; set downState(value: DisplayObject); /** * A Boolean value that specifies whether a button is enabled. When a * button is disabled (the enabled property is set to false), * the button is visible but cannot be clicked. The default value is * true. This property is useful if you want to * disable part of your navigation; for example, you might want to disable a * button in the currently displayed page so that it can't be clicked and * the page cannot be reloaded. * * Note: To prevent mouseClicks on a button, set both the enabled * and mouseEnabled properties to false. */ get enabled(): boolean; set enabled(value: boolean); /** * Specifies a display object that is used as the hit testing object for the button. For a basic button, set the * hitTestState property to the same display object as the overState * property. If you do not set the hitTestState property, the SimpleButton * is inactive β€” it does not respond to user input events. */ get hitTestState(): DisplayObject; set hitTestState(value: DisplayObject); /** * Specifies a display object that is used as the visual * object for the button over state β€” the state that the button is in when * the pointer is positioned over the button. */ get overState(): DisplayObject; set overState(value: DisplayObject); /** * The SoundTransform object assigned to this button. A SoundTransform object * includes properties for setting volume, panning, left speaker assignment, and right * speaker assignment. This SoundTransform object applies to all states of the button. * This SoundTransform object affects only embedded sounds. * @internal Should information from AS2 setTransform be here? e.g. percentage values indicating * how much of the left input to play in the left speaker or right speaker; it is generally * best to use 22-KHZ 6-bit mono sounds? */ get soundTransform(): SoundTransform; set soundTransform(value: SoundTransform); /** * Indicates whether other display objects that are SimpleButton or MovieClip objects can receive * user input release events. The trackAsMenu property lets you create menus. You * can set the trackAsMenu property on any SimpleButton or MovieClip object. * If the trackAsMenu property does not exist, the default behavior is * false. * * You can change the trackAsMenu property at any time; the * modified button immediately takes on the new behavior. */ get trackAsMenu(): boolean; set trackAsMenu(value: boolean); /** * Specifies a display object that is used as the visual * object for the button up state β€” the state that the button is in when * the pointer is not positioned over the button. */ get upState(): DisplayObject; set upState(value: DisplayObject); /** * A Boolean value that, when set to true, indicates whether * the hand cursor is shown when the pointer rolls over a button. * If this property is set to false, the arrow pointer cursor is displayed * instead. The default is true. * * You can change the useHandCursor property at any time; * the modified button immediately uses the new cursor behavior. * @maelexample Create two buttons on the Stage with the instance names * myBtn1_btn and myBtn2_btn. Enter the following ActionScript in Frame 1 of the Timeline: * * myBtn1_btn.useHandCursor = false; * myBtn1_btn.onRelease = buttonClick; * myBtn2_btn.onRelease = buttonClick; * function buttonClick() { * trace(this._name); * } *

When the mouse is over and clicks myBtn1_btn, * there is no pointing hand. However, you see the pointing hand when the button is over and clicks * myBtn2_btn.

*/ get useHandCursor(): boolean; set useHandCursor(value: boolean); clone(): SimpleButton; } //# sourceMappingURL=SimpleButton.d.ts.map