stageToFlash

Syntax: stageToFlash (sprite whichFlashSprite, pointOnDirectorStage)
Type: Function
Description: This function returns the coordinate in a Flash movie sprite that corresponds to a specified coordinate on the Director stage. The function accepts both the Director stage coordinate and returns the Flash movie 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 stageToFlash and the corresponding FlashToStage 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 checks to see if the mouse (whose location is tracked in Director stage coordinates) is over a specific coordinate (130,10) in a Flash movie sprite in channel 5. If the mouse is over that Flash movie coordinate, the script stops the Flash movie.
on checkFlashRollover
	if stageToFlash(sprite 5, point(the mouseH,the mouseV) = point(130,10) then
		stop sprite 5
	end if
end

Related Lingo: flashToStage function

Previous | Next