Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example of usage of Flex player

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you an example of the use of Flex player, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!

Flex player

Loading the buffer progress bar of songs with mx:ProgressBar

ProgressBar has three major mode modes: event, manual, and polled,event are event-driven modes, which can be set to automatically display the loading process of source objects; manual is manual mode, and you need to call the ProgressBar.setProgress () method to set scroll bar progress; polled is polling mode, and manual mode is used in this example. Sound loads load request songs to add a monitoring event in ProgressEvent.PROGRESS processing, and then sets setProgress progress according to the number of bytes and bytesTotal loaded by Sound. It should be noted that the ProgressEvent.PROGRESS event must be removed when switching songs, otherwise there will be a problem that ProgressBar triggers multiple PROGRESS events to scroll back and forth before the playback song is loaded and the new song is switched to load.

Mx:HSlide adjusting slippery stalk

This control is used in 2 places in this example to control the playback progress and sound volume of the Flex player. The problem of adjusting the playback schedule at first baffled me for a long time, because in the process of song playback, HSlide needs to automatically slide the current playback position, and at the same time, it needs to be able to drag the playback position manually. HSlide originally had a good change event to listen for changes, but I actually triggered the change event for me when I used the timer to set up HSlide's value, referring to the help documentation on Adobe's official website. It is said that the value of the Slider component changes due to mouse or keyboard interaction, and if the liveDragging property is true, the event is continuously dispatched as the user moves the slider. If liveDragging is false, the event is dispatched when the user releases the slider. But no matter how I set it, how does changing the value of HSlide in the code trigger the change event? isn't it scheduled when the user interacts and changes? Scoundrel, later can only compromise to monitor the thumbDrag slider drag event, this event is when the slider is pressed and then moved with the mouse scheduling, so there will be a small problem, that is, the need to drag the slider press will trigger, click invalid.

SoundMixer.computeSpectrum () Analysis Audio Curve

In this example you can see that the audio curve displayed is actually 64 Canvas controls drawn into bars on the right, and then use the timer to reset their scaleY position every 100ms to show the effect of a variable curve, the code is only three lines very simple, see the timerTick event given by my source code below. Why use timers here? Watching others on the Internet is monitoring Event.ENTER_FRAME events to redraw the audio curve, do not want to make so much trouble directly use the timer, casually calculate the song playback time according to bytesTotal and bytesLoaded, the use of 100ms timer is not easy to consume station resources, CPU did not rise very high.

The above is all the contents of the article "examples of the usage of Flex players". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report