English 中文(简体)
如何在SAP3中合理组织节奏/激励?
原标题:How should one logically organize rhythm/timing in AS3?

I m working on a rhythm-based game set to a specific song in ActionScript, in which a trigger spawns on the right side of the screen and moves left. The player must hit the trigger when it touches the left side of the screen, and I m trying to figure out the most code-efficient way to spawn triggers in sync with the timing of the song. The only thing that came immediately to mind was an update function tied to the main loop that checks if the song is at a certain second each frame, but that seems unnecessary. Any ideas?

最佳回答

我认为,最容易做这种比较准确的事情是

1/put the music into a .flv file and add cue points to it. Then the triggers can be synced to the cue points. My guess is that you ll also have to offset them somewhat to match what you see to what you hear though. It will definitely take some experimentation. With this solution however you need to keep in mind that the streaming of the file can be staggered, paused etc. depending on the D/L rate.

2/Another solution would be to imp或t the sound into the timeline of a movieclip as a stream and then let it dispatch events on the c或responding frames to sync it with triggers. I think this will be the most precise solution.

我认为,通过守则充分做到这一点还不够准确,显然也取决于音乐。 如果你重新使用电子音乐,那么风.是机器的“效应”,但是如果它把人类带走,就会有轻微的变异和“灵敏”的rew。 然而,如果你想走这条道路,

3/ you ll need to analyse the data that is produced through SoundMixer.computeSpectrum http://help.adobe.com/en_US/FlashPlatf或m/reference/actionscript/3/flash/media/SoundMixer.html#computeSpectrum()

显然,如果你想要更新歌曲,那就是唯一的解决方案。

我在这些事情上没有很多经验,但也许会有更好的解决办法。

问题回答

暂无回答




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

Red5 Security Tutorial

I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

visible property of DisplayObject

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen?...

热门标签