Delphi flash playback

Source: Internet
Author: User
9. setzoomrect
Syntax: setzoomrect (left as long, top as long, right as long, bottom as long)
Note: enlarge the rectangle area specified in the video to the control size.
The coordinate values of left, top, right, and bottom are calculated relative to the effective position of the video in the control. Note that this function is calculated from the upper left corner of the effective area of the video, rather than the upper left corner of the control.
Example: enlarge the rectangular area of the video at 200x200 points starting from the upper left corner:
Pointstotwips = 20;
Movie. setzoomrect0, 0,200 * pointstotwips, 200 * pointstotwips
10. Stop
Syntax: Stop ()
Stops playing a video.
Example: movie. Stop
11. stopplay
Syntax: stopplay ()
Stops playing a video.
Example: movie. stopplay
12. tcallframe
Syntax: tcallframe (target as string, framenum as long)
Note: In the timeline specified by the target, the action in the frame specified by framenum is executed.
Example: To run the 5th-frame action in the main timeline:
Movie. tcallframe "/", 4
13. tcalllabel
Syntax: tcalllabel (target as string, label as string)
Note: In the timeline specified by the target, the action in the frame specified by the label is executed.
Example: To run the action in the frame "handlescriptpolicy" in the main timeline:
Movie. tcalllabel "/", "handlescriptpolicy"
14. tgotoframe
Syntax: tgotoframe (target as string, framenum as long)
NOTE: For the timeline specified by the target, it is transferred to the frame specified by framenum.
Example:
Movie. tgotoframe "/movieclip", 2
15. tgotolabel
Syntax: tgotolabel (target as string, label as string)
NOTE: For the timeline specified by the target, it is transferred to the frame specified by the label.
Example: movie. tgotolabel "/movieclip", "mylabel"
16. tplay
Syntax: tplay (target as string)
Note: The timeline specified by the target is played.
Example: movie. tplay "/movieclip"
17. tsetproperty
Syntax: tsetproperty (target as string, property as long, value as string)
NOTE: For the timeline specified by target, set the attribute specified by property to the value (string ). Property is a number representing the corresponding property (see the appendix for details ).
Example:
Dimnameindexaslong
Nameindex = 13
Movie. tsetproperty "/movieclip", nameindex, "newname"
18. tsetpropertynum
Syntax: tsetpropertynum (target as string, property as long, value as double)
NOTE: For the timeline specified by the target, set the attribute specified by the property to the value (number ). Property is a number representing the corresponding property (see the appendix for details ).
Example:
Dim visibilityindex as long
Visibilityindex = 7
Movie. tsetproperty "/movieclip", visibilityindex, 1
19. tstopplay
Syntax: tstopplay (target as string)
Description: The timeline specified by the target to stop playback.
Example:
Movie. tstopplay "/movi1_tostop"
20. Zoom
Syntax: Zoom (factor as long)
Description: scales the view by the relative percentage specified by factor. Factor can be understood as the percentage of the film displayed in the control window to the actual size. If factor is set to 0, the view is restored to the 100% size. When the current view is 100%, it cannot be reduced.
Example: double the video size:
Movie. zoom50
The following methods return values:
21. currentframe
Syntax: currentframe () as long
Description: returns the current number of frames of a video. The first frame of the video is 0.
Example:
Dim framenow as integer
Framenow = movie. currentframe
22. flashversion
Syntax: flashversion () as long
Note: The control version number is returned. The value consists of three bytes, namely the main version number, minor version number, and revision version number. For example, if I use the flash player control, the returned value is 327722, which is equivalent to the hexadecimal & h05002a, which is equivalent to 5.00.42.
Example: Program Display the version number of the control you are using:
Dim vernum, majornum, minornum, revisionnum as long
Vernum = movie. flashversion
Majornum = vernum \ 65536
Minornum = (vernum-majornum * 65536) \ 256
Revisionnum = vernum mod 256.
Msgbox "version number of your Flash Player control:" & majornum & "." & minornum & "." & revisionnum
23. getvariable
Syntax: getvariable (name as string) as string
Description: return the value of the flash variable specified by name. If the variable does not exist, null is returned.
Example:
Dim firstname, radiobuttonvalue as string
Firstname = movie. getvariable "firstname"
Radiobuttonvalue = movie. getvariable ("/form/radiobutton: Value ")
24. isplaying
Syntax: isplaying () as Boolean
Returns true if the video is being played.
Example:
If movie. isplayingthen
Msgbox "video playing! "
End if
25. percentloaded
Syntax: percentloaded () as long
Description: returns the percentage of films currently loaded. The value range is from 0 to 100.
Example:
Dimloaded as Boolean
If movie. percentloaded = 100 then
Loaded = true
End if
26. tcurrentframe
Syntax: tcurrentframe (target as string) as long
Returns the number of the current frame in the timeline specified by the target. The returned frame number starts from 0, that is, the first frame of the video is 0, the second frame is 1, and so on.
Example:
Dim currentframe as long
Currentframe = movie. tcurrentframe ("/movieclip ")
27. tcurrentlabel
Syntax: tcurrentlabel (target as string) as string
Returns the tag of the current frame in the timeline specified by the target. If there is no tag for the current frame, an empty string is returned.
Example:
Dim currentlabel as string
Currentlabel = movie. tcurrentlabel ("/movieclip ")
28. tgetproperty
Syntax: tgetproperty (target as string, property as long) as string
NOTE: For the timeline specified by the target, the attribute value (string) specified by the property is returned ). Here, property is a number representing the corresponding property (see the appendix for details ).
Example:
Dim nameindex as long
Dim name as string
Nameindex = 13
Name = movie. tgetproperty ("/", nameindex)
29. tgetpropertynum
Syntax: tgetpropertynum (target as string, property as long) as double
NOTE: For the timeline specified by the target, the attribute value (number) specified by the property is returned ). Here, property is a number representing the corresponding property (see the appendix for details ).
Example:
Dim framesloadedindex as long
Dim framesloaded as double
Framesloadedindex = 12
Framesloaded = movie. tgetproperty ("/", framesloadedindex)
Appendix: Obtain and set attributes. The numbers of each attribute can be used in tgetproperty, tgetpropertyasnumber, tsetproperty, or tsetpropertynum to indicate the attribute to be accessed.
This is almost the case. We can perform most operations on flash films. I think you may still feel unsatisfied and unwilling to give up on perfection. You must be perfect. Let's see what else to do.
Iii. Events
Think about it. Some flash videos are automatically switched to full-screen mode when they are turned on. Some videos are turned on and you change the player size, so the video screen will not change. In other videos, the Flash Player menu is hidden. There is no "Hide menu" function in the player that comes with flash. Why? Let's watch it with me. Let's hear the "sound" of the Flash video ".
1. fscommand
Syntax: fscommand (command as string, argS as string)
Note: The fscommand Action added to the video in flash can pass information from the video to the Flash Player, when a video is played by a flash player or a webpage or program that contains a player control, the corresponding action is performed based on the obtained information to implement internal interaction between the video and external applications. For example, add the following action to a button image in flash:
On (release ){
Fscommand ("fullscreen", "true ");
}
When the flash player plays this file, click the button to switch to full screen mode. The following are the commands and their parameters that flash players can recognize:
Command: Quit
Parameter: No Parameter
Purpose: Disable the player.
Command: fullscreen
Parameter: true or false
Purpose: Set true to enable the player to play in full screen mode. Set false to enable the player to play back in normal window mode.
Command: allowscale
Parameter: true or false
Purpose: if it is set to false, the video will not change with the player size, and the original size will always be maintained, equivalent to 100% in the player menu; if it is set to true, the size of the video that changes with the player size will be restored, it is equivalent to showall in the player menu.
Command: showmenu
Parameter: true or false
Purpose: Set true to display all menus, including the Right-click menu of the menu bar and the playback area. Set false to not display the menu bar. There is only one "aboutmacromediaflashplayer..." in the right-click menu of the playback area ...".
Command: Exec
Parameter: Application path and name
Purpose: run a specified application. For example, add an action to a flash video as follows:
Fscommand ("EXEC", "Regedit ");
When the player plays a video, this action opens the Registry Editor Program. Note: The player that comes with flash will execute corresponding actions after receiving these commands, but there will be no response in the control, the command and ARGs received by the program in the fscommand event can be analyzed and programmed to handle the problem.
2. onprogress
Syntax: Event onprogress (percentdone as long)
Note: This occurs when a Flash video is downloaded. Percentdone is the percentage of downloaded videos. The value ranges from 0 to 100.
Example: display the download progress in the title bar of the form:
Private sub movie_onprogress (byval percentdone as long)
Form1.caption = "downloaded:" & percentdone & "%"
End sub
3. onreadystatechange
Syntax: Event onreadystatechange (newstate as long)
Note: This happens when the preparation status of the control changes. Possible values of newstate are listed below:
0 -- Loading
1 -- not initialized
2 -- loaded
3 -- interacting
4 -- complete
Example: after the video is loaded, a prompt is displayed, and then the video is played:
Private sub movie_onreadystatechange (newstate as long)
If newstate = 4 then
Msgbox "the video has been loaded! "& Vbcrlf &" Total Video Frames
Number: "& movie. totalframes
Movie. Play
End if
End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.