开发者

Operating on objects using Flash AS3 that were created manually by a designer in the timeline

I was trying to build an application where a designer has created content on the timeline as a sequence of key frames. Each key frame is completely different. When the application is started I choose one of the frames, move the play head to that frame and stop (using gotoAndStop). Next, by referring to symbols in the key frame by name, I use AS3 to allow drag and drop, and I also do some programmatic movement.

The problem开发者_如何学运维 is that when I move to a different key frame on the timeline using gotoAndStop, the symbols that were touched by AS3 in the previous frame, even if they are not referenced by the designer's key frame, show up on the stage. It is as though any DisplayObject that I touch with AS3 becomes divorced from the timeline.

Does anyone have any suggestions about how to programatically work with timeline (MovieClip) content that was manually created by a designer. This just seems like it should be a really common use case. It seems that about the only thing I can do safely with the timeline is to move the play head and respond to events (if I don't change the state of DisplayObjects in the timeline). Also, is there any good documentation on how objects get allocated and destroyed when the timeline plays?

Thanks!


The problem is that when I move to a different key frame on the timeline using gotoAndStop, the symbols that were touched by AS3 in the previous frame, even if they are not referenced by the designer's key frame, show up on the stage. It is as though any DisplayObject that I touch with AS3 becomes divorced from the timeline.

If you are not adding and removing things from the display object list, or toggling object depth, that should not be the case at all.

Are you sure they are not being referenced by the designers keyframe at all? Otherwise you might want to try a different approach than just coding in the timeline.

One way to merge FLAs with custom code is to have the movie clip symbols created by the designer, have them exported extending a custom AS class. This way the designer can fiddle with the look and your .as class can control functionality.

To do this, set your movieclip to "Export for ActionScript" and then choose a class file that you wrote in the "Class" field. Make sure your class extends MovieClip.

This is also awesome because you can code in your AS file as the designer is working in Flash and you dont have to share the same file.

This doesn't necessarily solve all your problems, rather it is a workflow recommendation that might work for you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜