有没有一种方法来访问图像数据的影片剪辑
一个特殊帧(儿童/转换信息),而无需使用 gotoAndStop
的方法。
Is there a way to access the image data (children/transformation info) of a particular frame in a MovieClip
without having to use the gotoAndStop
methods.
这些方法都是渲染管线的一部分,我要的是对数据的访问,而不是开始一个链开发,以呈现在屏幕上的东西,调用多个事件侦听器,并执行帧动作异步事件。
These methods are part of a rendering pipeline, all I want is access to the data, not to start a chain of asynchronous events that were developed to render things on screen, call multiple event listeners and execute frame actions.
您不仅可以这样做,但 gotoAndStop()
甚至没有立即作出这样的数据可用。一帧的内容无法访问,直到 FRAME_CONSTRUCTED
当达到该帧事件分派,所以你实际上需要做的更像是:
Not only can you not do that, but gotoAndStop()
doesn't even immediately make that data available. The contents of a frame aren't code accessible until the FRAME_CONSTRUCTED
Event is dispatched when that frame is reached, so what you would actually have to do is more like:
var lastFrame:int = currentFrame;
function ready(e:Event):void
{
if(currentFrame !== lastFrame)
{
// In this example, frame 15 is where some image
// data we want is.
if(currentFrame === 15)
{
// Get image data.
//
}
lastFrame = currentFrame;
}
}
addEventListener(Event.FRAME_CONSTRUCTED, ready);
自不必说;您需要跨帧存储数据不是一个可行的方法来构造一个应用
Needless to say; storing data you need across frames is not a viable way to structure an application.