### flashToStage

Syntax: | `FlashToStage (sprite` `whichFlashSprite, pointInFlashMovie``)`
Type: | Function
Description: | This function returns the coordinate on the Director stage that corresponds to a specified coordinate in a Flash movie sprite. The function accepts both the Flash movie coordinate and returns the Director stage coordinate as Director point values; for example, point(300,300).
| Flash movie coordinates are measured in Flash movie pixels, which are determined by a movie's original size when it was created in Flash. For the purposes of calculating Flash movie coordinates, point(0,0) of a Flash movie is always at its upper-left corner. (The cast member's `originPoint` property is not used to calculate movie coordinates; it is used only for rotation and scaling.)
| The `FlashToStage` and the corresponding `stageToFlash` functions are helpful for determining which Flash movie coordinate is directly over a Director stage coordinate. When a Flash movie is positioned on the Director stage, its upper-left corner, expressed as point(0,0), will not always be at the upper-left corner of the Director stage, which is also expressed as point(0,0). As a Flash sprite is stretched, its `scaleMode` property will affect the way its coordinates shift over the Director stage. Also, Flash movies can be scaled and rotated, further complicating the task of matching coordinates. The `FlashToStage` and `stageToFlash` functions make it possible to determine with a high degree of accuracy which coordinate in a Flash movie is directly over a coordinate on the Director stage.
Example: | This handler accepts a point value and a sprite reference as a parameter, and it then sets the upper-left coordinate of the specified sprite to the specified point within a Flash movie sprite in channel 10.

    on snapSprite whichFlashPoint, whichSprite
    	set the locH of sprite whichSprite = the locH of FlashToStage(sprite 10, whichFlashPoint)
    	set the locV of sprite whichSprite = the locV of FlashToStage(sprite 10, whichFlashPoint)
    	updatestage
    end

Related Lingo: | `stageToFlash` function

Previous | Next